Skip to content

AI and maps

Build an AI image generator in Div-idy

Div-idy documentation Updated

Div-idy can build an app that generates images from a visitor’s prompt using its built-in AI runtime. Ask for a prompt field, an explicit Generate action, and a result display. You do not need your own API key. Image requests use the project owner’s AI Tools budget.

Choose an image-generation workflow

You can build an illustration idea tool, moodboard image generator, character concept creator, or visual prompt playground. Describe the audience and useful controls: subject, style, composition, colors, and aspect ratio are easier to use than an unexplained technical form.

This is an AI feature inside the finished app. It is separate from asking Div-idy to create artwork while building the app’s own interface.

Choose supported image options

New React output uses ai.image, which returns an image address the app can display. Supported sizes are square at 1024 × 1024, portrait at 1024 × 1536, and landscape at 1536 × 1024. Quality options are low, medium, and high; output formats include WebP, PNG, and JPEG.

Keep image prompts within 4,000 characters. A simple product can choose defaults and expose only the controls its audience needs. Start with one generated image per deliberate request.

Example: an illustration studio

Build a React illustration generator with fields for subject, visual style, and colors. Offer square, portrait, and landscape formats. Use Div-idy’s built-in image generation when the user clicks Generate. Show a loading indicator, disable duplicate requests, display the returned image, and preserve the prompt on error. Include an editable prompt summary before generation.

Make each request understandable

  1. Validate the prompt before sending it.
  2. Start generation only when the visitor chooses Generate.
  3. Show progress and keep the initiating control disabled while pending.
  4. Display the image only after a successful response.
  5. Show errors and offer a manual retry without discarding the prompt.

Do not start generation on page load, timers, or automatic retries. A visitor choosing another style should be able to review the change before spending another request.

Check results, persistence, and budget

Test each exposed size, a blank prompt, a successful request, and an error state. Review generated images before using them. Image editing is not available through the generated-app runtime.

A returned image is not automatically a permanent gallery entry. Specify and test any save behavior separately; do not put large image data into compact database records. See AI usage and limits and image understanding and speech for related capabilities.