|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIG. - Google AI > 6. Core Operations > AIG.GenerateImage |
MiniRobotLanguage (MRL)
AIG.GenerateImage
Generate images from text prompts using Imagen 3.
Intention
To create high-quality images based on a textual description using Google's Imagen 3 model via the Gemini API.
What does the GenerateImage command do?
This command sends a request to the image generation endpoint. It automatically handles the API differences (switching from `:generateContent` to `:predict`) and saves the resulting image(s) to disk.
Important Prerequisites:
•You MUST set the model to an Imagen model first (e.g. `imagen-3.0-generate-002`).
•This command requires `v1beta`. Use AIG.SetApiVersion|v1beta.
Example Usage
// 1. Configure for Image Generation
AIG.SetApiVersion|v1beta
AIG.SetModel|imagen-3.0-generate-002
// 2. Set output filename (Optional, otherwise auto-generated)
AIG.SetSaveToFile|C:\Images\MyRobot.png
// 3. Generate Image (Prompt | Ratio | Count)
AIG.GenerateImage|A futuristic robot painting a canvas|16:9|1|$$FilePath
// 4. Check result
IVV.$$FilePath!""
DBP. Image saved to: $$FilePath
EXO.$$FilePath
ELSE
DBP. Generation failed.
EIF.
Syntax
AIG.GenerateImage|P1|P2|P3[|P4]
AIG.genimg|P1|P2|P3[|P4]
AIG.gen|P1|P2|P3[|P4]
Parameter Explanation
P1 - Prompt (Text). The detailed description of the image you want to create.
P2 - Aspect Ratio (String). Supported values: `1:1`, `16:9`, `9:16`, `4:3`, `3:4`.
P3 - Count (Integer). Number of images to generate (1 to 4).
P4 - (Optional) Variable to store the full file path of the saved image.
See also: