Skip to main content

Retool AI image actions

Learn how to generate images with Retool AI.

You can use the Retool AI resource to write queries that leverage AI models to generate images. The AI model returns a base64-encoded string of the image.

As with all queries, the response is available at {{ }}. You can display base64-encoded images in any Retool component that support images, such as the Image or Avatar components.

Get started

To get started with Image actions for apps, add a new AI Action query. For workflows, add a new AI Action block.

Generate an image

Use the Generate image action to generate an image based on the instructions you provide.

  1. Select the Generate image action.
  2. Enter some instructions in the Input field.
  3. Select the AI model to use, (e.g., dall-e-2).
  4. Click Save and then Run to perform the action.

The query output then displays a preview of the base64-encoded image that the AI model returns.

Image constraints

AI models typically generate image/png images with a maximum resolution (e.g., 1024x1024px for dall-e-2). You can specify custom dimensions but they cannot exceed the maximum limit.