# Image Generation

Describe the image you want in plain language and Treasure AI Studio creates it for you, right in the conversation. Beyond generating images from scratch, the AI can edit images you provide — fill in a masked region, composite a logo onto a product, or restyle an existing picture — and render the result inline so you can review and download it without leaving the chat.

Note
Image generation runs through the `tas-imggen` command inside the sandbox execution environment, backed by OpenAI's GPT Image model. The AI calls it for you in response to natural-language requests — you do not need to learn the command. Every call appears in the tool call expansion, so you can see exactly what prompt and options were used.

Installed plugins or skills may change this behavior
If you have installed a plugin or skill that provides its own image generation, the AI may route your request through that plugin instead of the built-in `tas-imggen` workflow described here — producing different results, options, or output. If image generation doesn't behave as documented, review your active [Skills & Marketplace](/products/ai-studio/skills/skills) plugins and disable any that handle image generation.

## Objective

Create new images and edit existing ones through natural-language requests in chat, control the size, quality, and format of the output, and view or download the generated images inline.

## Prerequisites

- Signed in to Treasure AI Studio ([Getting Started](/products/ai-studio/getting-started))
- A Treasure AI Studio plan that includes image generation (the feature is not available on free accounts)


## Generating Images Through the AI

The simplest way to create an image is to describe what you want:

- "Create a minimalist logo for a coffee brand called *Northwind*, flat vector style on a white background"
- "Generate a hero banner of a city skyline at dusk, wide aspect ratio"
- "Make an illustration of a friendly robot waving, transparent background"


The AI turns your request into an image prompt, runs `tas-imggen generate`, and renders the finished image inline in the chat stream.

Treasure AI Studio chat: a natural-language request to create a minimalist Northwind coffee-brand logo, the AI running tas-imggen --help and tas-imggen generate via tool calls, and the generated logo shown in the Artifacts panel
### What Happens Under the Hood

1. **You describe the image** in natural language
2. **The AI builds a prompt** and runs the generation command via the Bash tool: `tas-imggen generate --prompt "..."`
3. **The tool call appears** in the chat, showing the command and options being used
4. **The image renders** inline once generation completes, and is saved as a file in the session
5. **The AI continues** the conversation — you can ask for refinements, variations, or a higher-quality version


You can watch each step in real time. While the command runs, a spinner indicates progress; on completion, the image appears and the tool call becomes expandable so you can inspect the exact prompt and options.

## Editing Existing Images

Ask the AI to edit an image that is already in the session — one you uploaded or one it generated earlier. The AI uses `tas-imggen edit`, which supports two common workflows:

| Workflow | What It Does | Example Request |
|  --- | --- | --- |
| **Masked edit (inpainting)** | Focuses the edit on a specific region of the image, keeping the rest as close to the original as possible. The AI prepares a mask whose transparent area marks the region to change. | "Change only the sky in this photo to a sunset" |
| **Subject-driven / compositing edit** | Uses one or more input images as material to produce a new image — for example, placing a logo onto a product or blending elements from several pictures. | "Put this logo on the front of the t-shirt in the product photo" |


The AI can supply **up to 16 input images** to an edit, which is useful when combining a subject, a reference style, and a brand asset in one request.

Name the image you want to edit
When the session contains more than one image, tell the AI exactly which file to edit — name it (for example, "edit *hero-v2.png*") or describe it unambiguously ("the logo I just uploaded"). The AI passes a specific file path to `tas-imggen edit`, so a clear reference keeps it from editing the wrong image. If you don't specify, the AI may pick a different file than you intended.

The AI prepares the mask for you
You don't create masks by hand. When you ask for a masked edit, the AI interprets your description and prepares the mask itself, marking the region to regenerate. Because the AI positions the mask based on what you say, describe the region as clearly as you can — for example, "only change the background." A vague description can lead to the wrong region being selected.

Because the model re-renders the image, areas outside the edited region may shift slightly rather than stay byte-for-byte identical. If you need the rest of the image preserved exactly, ask the AI to composite the regenerated region back onto the original using the mask.

## Controlling the Output

You can steer the output by asking for a specific size, quality, or file format. The AI maps your request to the corresponding options.

### Size

| Request | Resulting Size |
|  --- | --- |
| "Square image" | `1024x1024` |
| "Landscape / wide" | `1536x1024` |
| "Portrait / tall" | `1024x1536` |
| "Let the model decide" | `auto` (the default) |


For **newly generated** images you can also ask for a custom size. The width and height must each be divisible by 16, the aspect ratio must stay within 1:3 and 3:1, and the total resolution must not exceed roughly 3840x2160. **Edits** support only `auto` or the three standard sizes above.

### Quality

Choose between **low**, **medium**, **high**, or **auto** quality. A practical pattern is to iterate cheaply, then finalize:

- Start at **low** while you refine the prompt — generations are faster and cost fewer credits
- Regenerate at **high** once you are happy with the composition


### File Format

The output format is chosen by the file extension. PNG is the default; JPG/JPEG and WebP are also supported.

- "Save it as a JPEG" → `.jpg`
- "Export as WebP" → `.webp`
- (no request) → `.png`


## Where Generated Images Appear

Generated and edited images are saved as files in the current session and appear both inline in the chat and in the **Artifacts panel**. You can:

- **View them inline** in the chat stream as soon as generation completes, including a file card you can download directly
- **Open the Artifacts panel** on the right to expand, download, or remove the image (see [Artifact Output](/products/ai-studio/files/artifacts))
- **Open them in the Image Viewer**, which scales the image to fit (see [File Viewers](/products/ai-studio/files/file-viewers))
- **Download them** from the chat file card or the Files panel (see [File Upload & Download](/products/ai-studio/files/file-upload-download))


## Credits & Usage

Image generation consumes Treasure AI Studio credits. Image generations are typically more expensive than text responses, and **high** quality costs more than **low** or **medium**. To keep usage efficient, iterate at low quality and switch to high only for the final render. Administrators can monitor consumption in the [Credit Usage Dashboard](/products/ai-studio/credits/credit-usage) and cap it with [Credit Policy](/products/ai-studio/credits/credit-policy).

## Best Practices

1. **Be specific in your description.** Mention the subject, style (for example, "flat vector", "photorealistic", "watercolor"), background, and mood. The more detail you give, the closer the first result.
2. **Iterate at low quality.** Refine the prompt and composition at low quality, then regenerate once at high quality to save credits and time.
3. **Describe the region for edits.** For masked edits, clearly state what should change and what should stay ("only replace the background"). The AI prepares the mask from your description.
4. **Provide clear input images for compositing.** When asking the AI to combine images (a logo, a product shot, a reference style), upload high-resolution sources for the best result.
5. **Ask for the right size up front.** Request the aspect ratio you need (square, landscape, portrait) so you don't have to regenerate to fix dimensions.


## Verification

- [ ] Ask "Create a simple square logo for a coffee brand" and see a tool call run `tas-imggen generate`
- [ ] See the generated image render inline in the chat
- [ ] Upload an image and ask the AI to edit a specific region, then compare the result
- [ ] Expand the tool call to see the exact prompt and options used


## Troubleshooting

| Issue | Solution |
|  --- | --- |
| Image generation does not run | Confirm your account is on a plan that includes image generation. The feature is not available on free accounts — contact your Customer Success Manager to enable it. |
| Image generation behaves differently than documented | An installed plugin or skill may be handling image generation instead of the built-in workflow. Review your active [Skills & Marketplace](/products/ai-studio/skills/skills) plugins and disable any that provide their own image generation. |
| The result doesn't match the prompt | Add more detail (subject, style, background) and regenerate. For small fixes, ask for a masked edit instead of a full regeneration. |
| The AI edited the wrong image | When several images are in the session, name the target file explicitly (for example, "edit *product-2.png*") or describe it clearly, so the AI passes the right file to the edit command. |
| A masked edit changed the wrong area | Describe the region more precisely ("only the sky", "just the logo area"). The AI rebuilds the mask from your description. |
| Custom size is rejected | For generated images, width and height must each be divisible by 16, the aspect ratio must be within 1:3–3:1, and the resolution must not exceed roughly 3840x2160. Edits support only `auto` or the standard sizes (1024x1024, 1536x1024, 1024x1536). |
| Generation feels slow or costly | Lower the quality to `low` or `medium` while iterating, and reserve `high` for the final image. |


## Next Steps

- [File Viewers](/products/ai-studio/files/file-viewers) — Preview generated images in the built-in Image Viewer
- [File Upload & Download](/products/ai-studio/files/file-upload-download) — Upload source images and download generated results
- [Charts & Data Visualization](/products/ai-studio/visualization/charts) — Render data as charts in chat
- [Credit Usage Dashboard](/products/ai-studio/credits/credit-usage) — Monitor credit consumption