What You Will Build
Reference-Guided Generation
Use an existing image to guide the AI output
Creative Variations
Generate new images that draw from a source composition
Subject Replacement
Replace or modify subjects while preserving scene context
Style Transfer
Apply different visual styles to referenced content
Before You Begin
Make sure you have:- A Pictory API key (get one here)
- Node.js or Python installed on your machine
- The required packages installed
- A publicly accessible URL for your reference image
Step-by-Step Guide
Step 1: Set Up Your Request
Prepare your API credentials, the reference image URL, and the prompt that describes the desired transformation or output.The
referenceImageUrl must point to a publicly accessible image. Ensure the URL does not require authentication or session cookies to access.Step 2: Submit the Image Generation Request
Send the request to the AI Studio image generation endpoint. The process is identical to text-to-image generation, with the addition of thereferenceImageUrl field.
Step 3: Poll for the Result
Check the job status at regular intervals until the image is ready.Understanding the Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | — | A text description that explains what to generate, referencing or modifying the source image. Must be between 5 and 5,000 characters. |
model | string | No | seedream3.0 | The AI model to use for generation. Supported values: seedream3.0, flux-schnell, nanobanana, nanobanana-pro. See Generate Image API for model capabilities and pricing. |
aspectRatio | string | No | First supported ratio of the selected model | The output aspect ratio. Valid values depend on the selected model (e.g., 1:1, 16:9, 9:16). |
style | string | No | — | Visual style to apply to the generated image. Supported values: photorealistic, artistic, cartoon, minimalist, vintage, futuristic. |
referenceImageUrl | string | No | — | A publicly accessible URL of the image to use as a visual reference. Must be a valid URI. |
webhook | string | No | — | A URL to receive a POST notification when the job completes. Must be a valid URI. |
Tips for Reference-Based Generation
- Describe the change clearly. State what should be modified from the reference image. For example, “Replace the car with a bicycle” is more effective than “Change the vehicle.”
- Mention the reference explicitly. Use phrases such as “in the referenced image” or “based on the provided image” so the model understands the relationship between the prompt and the reference.
- Preserve scene context. If you want to keep the background or composition, say so in the prompt. For example, “Keep the background and lighting unchanged.”
- Combine with styles. Applying a
stylesuch as"artistic"or"cartoon"transforms the reference into a different visual treatment while preserving the subject and layout.
Next Steps
- Generate Image from Text Prompt to create images without a reference
- Generate Image API Reference for the complete parameter documentation
