ce-gemini-imagegen

Generate and edit images using the Gemini API with text prompts and reference images.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/Norfolk-Group/marcela-norfolk-ai --skill ce-gemini-imagegen-norfolk-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ce-gemini-imagegen
Source: https://github.com/Norfolk-Group/marcela-norfolk-ai/tree/main/skills/compound-engineering/skills/ce-gemini-imagegen
Command: npx skills add https://github.com/Norfolk-Group/marcela-norfolk-ai --skill ce-gemini-imagegen-norfolk-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires google-genai, Pillow, and includes scripts (resource) components.

What problem does it solve? Creating or editing images programmatically requires wiring up API calls, handling response formats, and managing model options. This Skill provides ready-to-use scripts and a Python library for text-to-image generation, image editing, multi-image composition, and iterative refinement through the Gemini API. ## Core Features & Use Cases - Text-to-Image Generation: Create images from prompts with control over aspect ratio (1:1 to 21:9) and resolution (1K, 2K, 4K) using gemini-3-pro-image-preview. - Image Editing & Composition: Edit existing images with natural language instructions or combine up to 14 reference images into a single composition. - Multi-Turn Refinement: Iteratively refine generated images through conversational chat sessions with save, load, and reset commands. - Use Case: Generate a product mockup at 2K resolution, then refine it conversationally by asking to adjust lighting and add a logo, saving each iteration automatically. ## Quick Start Set the GEMINI_API_KEY environment variable and ask the AI to generate an image of your chosen subject using the Gemini image generation skill.

Frequently Asked Questions about ce-gemini-imagegen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate images with the Gemini API in Python?

Use the google-genai client with model gemini-3-pro-image-preview and set response_modalities to TEXT and IMAGE. Pass your prompt to generate_content, then save the inline image data from the response parts to a file.

How to edit an existing image with Gemini API?

Load the image with PIL and pass it alongside a text instruction to generate_content. The model understands semantic masking, so you can describe changes conversationally, such as adding objects or changing styles.

What aspect ratios and resolutions does Gemini image generation support?

Supported aspect ratios are 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, and 21:9. Resolutions are 1K, 2K, and 4K, configured via ImageConfig with aspect_ratio and image_size parameters.

Why does my saved Gemini image show a media type mismatch error?

The Gemini API returns images in JPEG format by default, so saving with a .png extension causes a mismatch. Save with a .jpg extension, or explicitly pass format="PNG" to PIL's save method to convert.

How many reference images can Gemini combine in one composition?

Gemini 3 Pro supports up to 14 reference images in a single composition request. Pass the instruction first, followed by the loaded PIL images, in the contents list.