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
- 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
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
