Image creation and adaptation

Create on-brand images from a prompt, adapt a design to new sizes, translate DITA maps, and keep your brand kits.

Besides translating the text in images, the Image Translation API creates new images, adapts existing designs to other sizes and formats, and translates DITA documentation maps. Brand kits hold your brand's identity for the work that uses it.

Set up your brand

Extract a brand identity from your website, a few images or a PDF brand book, check the result, then save it with Create a brand kit.

Create images

Generate an image from a prompt, then refine it with Edit a created image. Each call waits for the image and returns it.

Created images

Generate an image takes a prompt of up to 5,000 characters and waits until the image exists, usually 10 to 60 seconds. The response has the image's id, a signed url to download it and its storage key.

To change an image, call Edit a created image with at least one of:

  • instructions: what to change, in plain words.
  • annotations: changes pinned to points, with x and y as percentages of the width and height.
  • maskImageBase64: a mask that limits the edit to the painted area.
  • elementEdits: a change to one text, person or object. Get the elements and their names from Detect image elements.

An edit is a new image with its own id; the original is not changed.

statusMeaning
creatingThe image is being made.
doneThe image exists.
failedThe image could not be made. failure.code and failure.message say why, and failure.retryable whether to try again.

A failed image can be made again with Retry a failed image. List created images returns every image with fresh signed URLs; the URLs expire, so don't store them.

New images are not in your organization's assets until you call Save an image to assets. To translate the text in a created image, call Prepare images for translation and pass each key as sourceKey when you start an image translation.

Collections

A collection groups created images, for example by campaign. Create a collection, optionally with images in it, then add images. Deleting a collection keeps its images; deleting an image removes it from every collection.

Brand kits

A brand kit holds a name, up to five colors, heading and body fonts, a tone of voice, visual-style words and a logo (PNG, JPG or SVG, up to 2 MB).

Extract a brand identity reads these from a source and returns a draft without saving it. Set source to url, images or pdf and send the matching field. Fields it cannot find come back empty, so fill them in before you call Create a brand kit. Update a brand kit changes only the fields you send and keeps the kit's id.

When the brand's typeface is not a public font, upload the font file as the heading or body font: TTF, OTF, WOFF or WOFF2, up to 5 MB. The kit's headingFont or bodyFont becomes its family, and the kit lists it in fonts. Download a brand font returns the file.

Layout adaptation

Layout adaptation turns one design into many formats, such as a banner, a story and a square post.

  1. Get a design upload URL, then PUT the image to uploadUrl within 15 minutes. An image your organization already has, such as a created image, needs no upload: send its sourceKey instead.
  2. Create a design and choose the tier:
    • PRO (the default) analyzes the design first: its texts, subjects and logos. Each variant then gets a layout plan you can check, and you can review the results.
    • FLASH runs no analysis, so variants render straight away.
  3. Create variants: one per format, each with its width and height in pixels. The work runs in the background; poll each with Get a variant.
  4. For a Pro variant in PLAN_PENDING, approve its layout plan or revise it with your notes.
  5. Review a variant to check it against the original, and fix the issues it finds. Edit a variant with a prompt, or recrop it.
  6. Export a variant as PNG or JPEG, or several at once. To keep one in your assets, save it to assets.

Every render, edit, fix and recrop makes a new version of the variant. List variant versions shows them, and Activate a variant version switches back, for example to undo an edit.

DITA maps

Upload a DITA map translates a ZIP of DITA content with a translation memory (tmId) into one or more targetLanguages. The .xml, .dita, .ditamap and .svg files are translated; every other file is copied as is, and folders are kept.

The response has one ID per language in data.playgroundLogIds. Languages are translated one after another. Poll each with Get the file tree every 5 to 30 seconds:

statusMeaning
TODO, INITWaiting to start.
INPROGRESSBeing translated.
DONEEvery file is translated. Build the ZIP.
FAILEDSome files failed. Retry failed files, or retry one file.

When a language is DONE, call Build the translated ZIP. To check single files first, use Download a file.

Permissions

Each endpoint page lists the permission it needs. The API key needs them on the role of the person who created it.

ResourceCovers
translate_photo.image_creatorCreated images and collections.
brand_kitBrand kits, including extraction.
translate_photo.design_agentDesigns, variants and their versions.
translate_photo.dita_mapDITA maps.

Credits

Generating, editing and retrying an image, extracting a brand identity, analyzing a Pro design, every variant plan, render, edit, fix, recrop and review, a clean background, and every DITA map upload and retry are charged when they start. Without enough credits the API returns 402 and nothing starts. If the work fails on our side, the credits are refunded. Each endpoint that charges says so on its page, with the current rates. See Credits.

On this page