localize_image
Replace on-image text with translations while preserving layout, colors, and graphics. Saves localized image to disk and returns the file path.
Instructions
Localize an image in place by replacing its on-image text with translations.
Keeps every non-text element (layout, colours, graphics) intact and
re-renders the original text with the provided translations. Pair with
extract_image_text (to get the source strings) and translate (to
translate them with TM and brand voice) for a full image localization flow.
The localized image is saved to disk and the file path is returned — the raw image bytes are not sent back to the model.
Args: image_path: Path to a local PNG, JPEG, or WebP image to localize. replacements: JSON array of {"original": "...", "translated": "..."} pairs, e.g. '[{"original": "Buy now", "translated": "Achetez maintenant"}]'. target_language_code: Target language code (e.g. "fr-FR"), used for labelling output. output_path: Optional path to write the localized image to. Defaults to ".." next to the source image. num_images: Number of variants to generate (1-5, default 1). output_format: Output format — png, jpeg, or webp (default png).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_path | Yes | ||
| num_images | No | ||
| output_path | No | ||
| replacements | Yes | ||
| output_format | No | png | |
| target_language_code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |