sup.ai.image
The sup.ai.image package provides AI-powered image generation and manipulation capabilities. It is accessed through sup.ai.image.
// Generate a simple imageconst image = sup.ai.image.create("a beautiful sunset over mountains");
// Generate with optionsconst hdImage = sup.ai.image.create("a futuristic cityscape", { aspectRatio: "16:9", model: "fast", quality: "high"});
// Generate using reference images for style/contentconst styledImage = sup.ai.image.create("a cat in this artistic style", { referenceImages: [sup.asset("style_reference.png")]});
// Generate with web search for real-time dataconst currentImage = sup.ai.image.create("today's news as a painting", { model: "gemini-3.1-flash-image-preview", useWebSearch: true});
// Analyze an imageconst description = sup.ai.image.interpret( image, "What objects are in this image?");
// Edit an imageconst editedImage = sup.ai.image.edit(image, "make it more vibrant");
// Edit with style referencesconst styledEdit = sup.ai.image.edit(image, "apply this style", { referenceImages: [sup.asset("style.png")]});Methods
sup.ai.image.create()
(prompt: string, options?: SupAIImageCreateOptions) → SupImage
// Basic usage - just a promptconst image = sup.ai.image.create("a beautiful sunset over mountains");
// With optionsconst hdImage = sup.ai.image.create("a futuristic cityscape", { aspectRatio: "16:9", model: "fast", quality: "high"});
// With reference images for style or content guidanceconst styledCat = sup.ai.image.create("a cat in this artistic style", { referenceImages: [sup.asset("style_reference.png")]});
// With multiple reference imagesconst combined = sup.ai.image.create("combine these characters into one scene", { referenceImages: [sup.asset("character1.png"), sup.asset("character2.png")]});
// With web search for real-time informationconst currentImage = sup.ai.image.create( "today's weather in New York as a painting", { model: "gemini-3.1-flash-image-preview", useWebSearch: true });Creates an image using AI based on a text prompt, optionally using reference images for style or content guidance.
Parameters:
prompt(string): The text description of the image to generateoptions(optional object):model('best'|'fast'|'gemini-3-pro-image'|'gemini-3.1-flash-image-preview'): The AI model to usequality('low'|'medium'|'high'): The quality level for generationaspectRatio(string): The desired aspect ratio (e.g.,'16:9','1:1')referenceImages(SupImage[]): Reference images to guide the style/content of the generated image (max 14). Only supported by'fast','gemini-3-pro-image', and'gemini-3.1-flash-image-preview'models.useWebSearch(boolean): Enable web search grounding for real-time data. Only supported by'gemini-3-pro-image'and'gemini-3.1-flash-image-preview'models.
Returns: A SupImage object containing the generated image
sup.ai.image.interpret()
(image: Image, prompt: string) → string
const description = sup.ai.image.interpret( image, "What objects are in this image?");Converts an image to text using AI image recognition.
Parameters:
image(SupImage): The image to analyzeprompt(string): The specific question or instruction for image interpretation
Returns: A string containing the AI’s interpretation of the image
sup.ai.image.edit()
(image: SupImage | SupImage[], prompt: string, options?: SupAIImageEditOptions) → SupImage
// Edit a single imageconst editedImage = sup.ai.image.edit(image, "make it more vibrant");
// Edit multiple images with specific qualityconst editedImages = sup.ai.image.edit( [image1, image2], "combine into a single black and white image", { model: "best", quality: "high" });
// Edit with style reference imagesconst styledEdit = sup.ai.image.edit( image, "apply this artistic style", { referenceImages: [sup.asset("style.png")] });
// Edit with web search for current contextconst updatedImage = sup.ai.image.edit( image, "update the outfit to current fashion trends", { model: "gemini-3.1-flash-image-preview", useWebSearch: true });Edits one or more images using AI based on a text prompt.
Parameters:
image(SupImage | SupImage[]): A single image or array of images to editprompt(string): The text description of how to edit the image(s)options(optional object):model('best'|'fast'|'gemini-3-pro-image'|'gemini-3.1-flash-image-preview'): The AI model to usequality('low'|'medium'|'high'): The quality level for editingmask(SupImage | string): A mask image to specify which areas to editreferenceImages(SupImage[]): Reference images to guide the style of the edited image (max 14). Only supported by'fast','gemini-3-pro-image', and'gemini-3.1-flash-image-preview'models.useWebSearch(boolean): Enable web search grounding for real-time data. Only supported by'gemini-3-pro-image'and'gemini-3.1-flash-image-preview'models.
Returns: A SupImage object containing the edited image
Notes
- Generated and edited images are returned as
SupImageobjects which can be displayed by returning them frommain(). - The AI models used may have specific limitations or requirements for prompts.
Model Availability
| Feature | 'best' | 'fast' | 'gemini-3-pro-image' | 'gemini-3.1-flash-image-preview' |
|---|---|---|---|---|
referenceImages | No | Yes | Yes | Yes |
useWebSearch | No | No | Yes | Yes |
referenceImages: Allows up to 14 reference images to guide the style or content of generated/edited images. Not available with the'best'model.useWebSearch: Enables web search grounding for real-time information (e.g., current events, trends). Only available with'gemini-3-pro-image'and'gemini-3.1-flash-image-preview'.