def METHOD_NAME(wan_model, group_id, base_pil, x_offset, color=None):
    g = wan_model.anim_groups[group_id]
    group_meta_entry = []
    # First find the max size needed
    max_size = 0
    for ani_i, ani in enumerate(wan_model.get_animations_for_group(g)):
        for frame_i, frame in enumerate(ani.frames):
            mfg_id = wan_model.frames[frame.frame_id]
            img, (cx, cy) = wan_model.render_frame(mfg_id)
            max_size = max(max_size, max((cx, cy)) + max((img.width, img.height)))
    group_meta_entry.append(max_size)
    group_entry = []
    group_meta_entry.append(group_entry)
    for ani_i, ani in enumerate(wan_model.get_animations_for_group(g)):
        ani_entry = []
        group_entry.append(ani_entry)
        for frame_i, frame in enumerate(ani.frames):
            ani_entry.append(frame.duration)
            # A single image
            mfg_id = wan_model.frames[frame.frame_id]
            img, (cx, cy) = wan_model.render_frame(mfg_id)
            if color is None:
                color = process_color(*get_dominant_color(img))
            oimg = outline_sprite(img, color)
            base_pil.paste(
                oimg,
                (
                    x_offset + ani_i * max_size - cx + int(max_size / 2),
                    frame_i * max_size - cy + int(max_size / 2),
                ),
            )
    return group_meta_entry, color