generate-image

Generate and edit images using OpenRouter image models like FLUX.2 Pro and Gemini 3.1 Flash Image Preview.

Updated Oct 7, 2022
One-click install
npx skills add https://github.com/tamagusko/linux-cfg --skill generate-image-tamagusko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-image
Source: https://github.com/tamagusko/linux-cfg/tree/main/dotfiles/claude/skills/generate-image
Command: npx skills add https://github.com/tamagusko/linux-cfg --skill generate-image-tamagusko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, and includes scripts (resource) components.

What problem does it solve? Creating custom images, illustrations, or edited visuals normally requires design tools or manual artwork. This Skill generates and edits images programmatically through OpenRouter's image generation models using simple text prompts. ## Core Features & Use Cases - Text-to-Image Generation: Create photos, illustrations, concept art, and visual assets from natural language prompts using models like FLUX.2 Pro and Gemini 3.1 Flash Image Preview. - Image Editing: Modify existing images (PNG, JPEG, GIF, WebP) with editing instructions, such as changing backgrounds or removing elements. - Model Selection: Choose between quality-focused models (flux.2-pro, gemini-3.1-flash-image-preview) or cost-efficient options (flux.2-flex). - Use Case: Generate a hero image for a conference poster or a conceptual illustration for a scientific paper, saved directly as a PNG file. ## Quick Start Ask the AI to generate an image of a sunset over mountains and save it as artwork.png using the generate_image.py script.

Frequently Asked Questions about generate-image

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

FAQPage Schema
How do I generate an image with OpenRouter in Python?

Run the generate_image.py script with a text prompt, for example: python scripts/generate_image.py "A sunset over mountains". The script calls the OpenRouter chat completions API and saves the result as a PNG file.

Which OpenRouter models support image editing?

Both google/gemini-3.1-flash-image-preview and black-forest-labs/flux.2-pro support image generation and editing. The flux.2-flex model supports generation only, so it cannot edit existing images.

How do I edit an existing image with a text prompt?

Pass the input image with the --input flag along with editing instructions, for example: python scripts/generate_image.py "Make the sky purple" --input photo.jpg. The image is base64-encoded and sent to the model with your prompt.

Why does the script say OPENROUTER_API_KEY not found?

The script requires an OpenRouter API key from https://openrouter.ai/keys. Add OPENROUTER_API_KEY=your-key to a .env file in your project directory, set it as an environment variable, or pass it with the --api-key flag.

What image formats can I use as input for editing?

The script accepts PNG, JPEG, GIF, and WebP files as input images. The file is encoded as a base64 data URL with the appropriate MIME type before being sent to the model.

When should I use a different skill instead of image generation?

For technical diagrams such as flowcharts, circuit diagrams, biological pathways, or system architecture schematics, use the scientific-schematics skill instead. This skill is intended for photos, illustrations, artwork, and general visual assets.