mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
## What changed Add the boolean `transparent_background` argument to `image_gen.imagegen` for generation and editing. Map `true` to `transparent` and `false` or omission to `opaque`, replacing the previous `auto` background setting. Update tool guidance to request transparency for background removal and cutouts, and to preserve existing transparency during edits unless the user asks to change it. ## Testing Add integration coverage for transparent, opaque, and omitted background arguments across generation, editing, and code-mode generation. Verify that `null`, string, and numeric values return a validation error without dispatching an image request. GitOrigin-RevId: b10ac200a619c72cc1787da41b49d65d0cde05dd
2.0 KiB
2.0 KiB
The image_gen.imagegen tool enables image generation from descriptions and editing of existing images based on specific instructions. Use it when:
- The user requests an image based on a scene description, such as a diagram, portrait, comic, meme, or any other visual.
- The user wants to modify an attached or previously generated image with specific changes, including adding or removing elements, altering colors, improving quality/resolution, or transforming the style (e.g., cartoon, oil painting).
Guidelines:
- imagegen needs a few minutes to finish. In code-mode, use the first-line @exec directive to give the initial call 120 seconds and the same yield for any waits that follow. Once it finishes, return the image with generatedImage(result).
- Avoid printing the full result or its base64 image data with
text()ornotify(); print only small metadata when needed. - Set
transparent_backgroundto true when the request calls for a transparent background, including background removal or a cutout; set it to false otherwise. For edits, preserve existing transparency unless the user asks to change it. - Omit both
referenced_image_pathsandnum_last_images_to_includewhen generating a brand new image. - For edits, use
referenced_image_pathswhen every target image has a local file path. - If you have not seen a local image yet, use
view_imageto inspect it before editing. - Use
num_last_images_to_includeonly when at least one target image has no local file path. - Set
num_last_images_to_includeto the smallest number of recent conversation images that includes every target image, up to 5. - Never provide both
referenced_image_pathsandnum_last_images_to_include. - If neither mechanism can include every target image, ask the user to attach the missing images again.
- Directly generate the image without reconfirmation or clarification unless required images must be attached again.
- Always use this tool for image editing unless the user explicitly requests otherwise. Do not use the
pythontool for image editing unless specifically instructed.