Claude Code can help you create image assets, but the important detail is how the pixels are produced. Claude Code reads your request, understands project context, and calls an external image-generation capability. That capability may arrive through a managed CLI and plugin, an MCP server, or a custom API wrapper. The result can then be saved, reviewed, renamed, and added to the same repository without breaking your coding flow.

This guide explains the full Claude Code image generation workflow: what is native and what is connected, how to choose a setup, how to install Media.io for a practical multi-model route, how to write project-aware prompts, and how to fix the failures that most often block the first successful output.
Media.io fit: If your goal is to produce real image files from Claude Code rather than only write prompts, Media.io can provide the connected generation layer. Keep the first result in a review folder until the tool, output path, and image quality are verified.
In this article
Start with the Pixel-Generation Boundary
Current reality: Claude Code can reason about a repository and orchestrate tools, but the connected image service produces the raster output. Media.io currently documents a Claude Code setup that installs its CLI, companion plugin, skills, and browser authentication before generation.
![]()
When you ask Claude Code to make an image, there are two different jobs. Claude interprets the request, reads relevant files, decides which tool to use, and prepares structured instructions. The connected image model performs the visual generation. The integration returns an output URL or local file path, which Claude can inspect or move into your project.
This boundary answers the common question, "Can Claude Code generate images?" Yes, it can coordinate image generation when an appropriate tool is connected. Without that tool, it may help write prompts, SVG, or code-based graphics, but it cannot automatically produce every raster asset you describe.
A useful mental model is: Claude Code is the creative operator, the integration is the bridge, and the image model is the renderer. This separation matters because model availability, supported aspect ratios, editing inputs, usage limits, and output formats belong to the connected service rather than to Claude Code itself.
Pick the Connection That Fits Your Project
Before adding another service, use what Claude can and cannot generate by itself to separate tasks Claude can handle directly from tasks that need an external raster generator. That decision tells you whether the project needs a connected image model, an MCP tool, or simply code-based graphics.

The key decision is whether Claude Code should call a managed plugin/CLI or a custom MCP/API wrapper. A managed route reduces setup work; a custom route gives you more control over tool schemas, credentials, and provider choice.
The best connection depends on whether you value fast setup, infrastructure control, or a custom production contract. Do not choose only by the model name. Consider authentication, output storage, maintenance, team sharing, and how easily Claude can discover the available action.
| Route | Best for | You manage | Main trade-off |
| Managed CLI and plugin | Fast setup, creators, multi-model access | Account sign-in and project instructions | Less control over the provider layer |
| Local MCP server | Developers who need source and runtime control | Runtime, dependencies, credentials, model IDs, updates, storage | More setup and maintenance |
| Direct API wrapper | Custom applications and strict schemas | Every request, response, retry, and security decision | Highest engineering effort |
A local MCP server versus API decision is not only about protocol preference. MCP gives Claude a discoverable tool contract. A direct API gives your code complete control, but you must build the function, validation, error handling, and output handoff that an agent can safely use.
For most people testing image generation in Claude Code, a managed setup is the shortest path to a useful result. Self-hosting becomes worthwhile when you need provider-specific controls, a local output policy, auditable server code, or an internal gateway.
Use Media.io for Image Generation in Claude Code
This topic has direct creation intent, so Media.io deserves a full workflow rather than a generic product mention. Use it when Claude Code needs to turn project context into real image files and you want a connected route that can cover new generation as well as reference-based image work.
| User need | Relevant Media.io route | How it helps here |
| Create a new visual from a brief | AI Image Generator / Text to Image | Use the article or repository context to define subject, composition, aspect ratio, and review criteria before generation. |
| Transform or preserve an existing visual | Image to Image / Nano Banana workflow | Use a source image when product identity, layout, character, or other visual references must survive the edit. |
| Call generation from an agent or terminal | Media.io CLI | Keep setup, authentication, model access, output paths, and the next project action inside the same working session. |
Copy This Complete Setup Prompt into Claude Code
After Setup, Test One Image Before Touching Production
- Ask Claude Code to generate one small image into a review folder.
- Require the returned file path and a short description of what was generated.
- Compare dimensions, text, logos, product details, and page fit against the real requirement.
- Only after approval should Claude Code rename or move the file and update imports or references.

Use a real Claude Code terminal or project capture plus the generated result. The visual should prove that setup, generation, file retrieval, and review are connected.
Create the First Asset in a Safe Review Folder
When the task starts from an existing asset, try the Nano Banana 2 image workflow with the same source file and record what must remain unchanged, such as subject identity, text, product shape, crop, or brand colors. Those constraints can become explicit review gates before Claude moves the result into the repository.

For project work, the best prompt starts with the asset role: hero illustration, empty-state graphic, social card, texture, or product mockup. Then add size, visual constraints, and where the approved file must be saved.
A weak request such as "make a hero image" forces Claude and the image model to guess. A stronger request explains the file's role, visual subject, composition, aspect ratio, style, constraints, destination, and review gate. This turns an isolated generation into a usable implementation step.
Copy-Ready Claude Code Prompt
Create three 16:9 hero-image options for this project. First read the homepage copy and existing color tokens. Keep the product visually accurate, use clean editorial lighting, leave practical negative space for the heading, and avoid logos or embedded text. Save drafts outside the production asset folder. Return the file paths and one sentence describing the difference between each option. Wait for my approval before copying the selected image to public/images/product-hero.jpg and adding accurate alt text.
The approval pause is important. Image generation is nondeterministic, and a technically successful file may still have incorrect product details, broken anatomy, unreadable text, or a composition that conflicts with the page. Keep drafts outside version-controlled production folders until someone approves the result.
Include Acceptance Criteria in the Request
- Required aspect ratio and minimum dimensions.
- What must remain accurate, especially products, people, logos, and reference-image identity.
- Where negative space is needed for interface copy.
- Elements that must not appear, including watermark, text, or competitor branding.
- Expected output filename and folder, but only after approval.
- Checks to run after integration, such as build, lint, broken-path, and responsive-layout tests.
For prompt refinement, use concrete visual language rather than stacking empty quality adjectives. The AI image prompt guide can help translate a broad concept into subject, setting, composition, light, style, and exclusions.
Turn a Design Request into a Reproducible Asset Brief
For new or edited assets, use a GPT Image 2 workflow to verify the fields your project actually needs: source files, target dimensions, transparency, output name, and revision notes. Return those details with the file path so a later Claude turn can tell which asset is current.

The real advantage of generating images in Claude Code is context. Claude can inspect a brief, design tokens, page structure, output folders, and naming rules before calling the creative tool. That makes the workflow suitable for recurring campaign assets, localized variants, blog illustrations, product mockups, and social crops.
- Store the brief near the project. Define audience, message, visual identity, protected product details, and prohibited content in a reusable file.
- Separate generation from approval. Save drafts in a temporary or review folder and require selection before production placement.
- Name by role, not by random job ID. Use predictable filenames such as campaign-product-hero.jpg and campaign-story-vertical.jpg.
- Generate formats intentionally. A crop is not always enough. Ask for compositions designed for wide, square, and vertical placements.
- Keep a human quality gate. Review factual accuracy, brand consistency, visual artifacts, rights, safety, and layout fit.
- Record useful prompts. Save the prompt and chosen model with the accepted asset so the team can revise or reproduce the direction later.
Use references sparingly and purposefully. One reference may establish product shape, another may establish visual style, but too many can introduce conflicts. For controlled transformations, start with the smallest set that preserves identity. If the generated asset needs additional work, move into an appropriate editing flow rather than repeatedly asking a text-to-image model to fix tiny details.
You can also compare what Claude can do with and without a connected image tool in the guide to whether Claude can produce images. The key is to match the capability to the requested deliverable.
Fix Missing Tools, Wrong Paths, and Weak Outputs
If the output looks wrong even though the tool call succeeds, compare the same brief with the Nano Banana 2 guide and isolate whether the problem comes from the source image, edit scope, prompt, or project handoff. Fix the creative input before changing repository automation.

| Symptom | Likely cause | Best first check |
| Claude only writes a prompt | No image tool is available or selected | Confirm the plugin or MCP tool is connected and discoverable |
| Authentication fails | Browser sign-in incomplete or session expired | Run the login flow again and finish authorization in the opened browser |
| Tool exists but generation fails | Unsupported model, bad parameter, usage limit, or provider error | Use a currently exposed model and simplify the first test |
| Image returns but no file appears | Invalid or inaccessible output path | Use an absolute writable path and verify folder permissions |
| Image is visually wrong | Prompt lacks role, composition, invariants, or exclusions | Add acceptance criteria and generate a small set of variants |
| Repository fills with drafts | No staging and approval policy | Generate outside the production asset folder |
Debug from the Connection Outward
Start by checking whether Claude can see the image capability. Then verify authentication, supported model, request parameters, input-file access, output-folder permission, and finally the project integration. This order prevents you from rewriting a good prompt when the real problem is a disconnected tool.
For a first test, remove reference images and advanced options. Request one simple landscape image and return only its saved path. Once that works, add the model choice, references, exact size, editing requirements, multiple variants, and automatic project changes one layer at a time.
Project context is useful when it becomes measurable constraints. Ask Claude Code to read the component or page that will use the image, identify the target ratio and safe area, and name the expected asset path before generation. After the image returns, review it against the actual page rather than in isolation. A visually attractive image can still fail if text overlaps the focal point, the crop breaks on mobile, or the file is too heavy for the intended surface.
FAQs About Claude Code Image Generation
Can Claude Code generate images natively?
Claude Code can plan and coordinate image generation, but raster pixels are typically produced by a connected image tool, model service, MCP server, plugin, CLI, or API wrapper.
What is the easiest way to generate images in Claude Code?
Use a managed CLI and companion plugin when you want the shortest setup. Install it, authenticate, verify the capability, and begin with one simple test prompt before adding project automation.
Should I use MCP or CLI for Claude Code image generation?
Use the supported workflow of your chosen service. MCP is useful when you want a standardized discoverable tool contract, while a CLI and plugin can package setup and file handling into a simpler project workflow.
Can Claude Code edit an existing image?
Yes, if the connected tool supports image editing. Provide an accessible source path, state exactly what may change, list what must remain fixed, and save the result as a new review asset.
How do I keep generated images out of Git until they are approved?
Generate into a review directory outside the production asset path, compare variants, and move only the approved file into the repository after visual QA.
Why does Claude Code return a prompt instead of an image?
The image capability may be missing, disconnected, or not explicitly selected. Verify the plugin, CLI, or MCP tool first, then ask Claude Code to call that capability and save the returned file.
Build a Visual Workflow, Not a One-Off Prompt
Claude Code image generation works best when visual production is treated like the rest of the project: define the requirement, choose a capable tool, protect credentials, generate outside production, review the result, and integrate only the approved asset. With that discipline, Claude becomes more than a prompt writer. It can coordinate a repeatable creative workflow from project context to finished file.