Style Reference Images

Use Style References images to generate variations based on specific styles, colors, artistic methods, or mood.

mountain

Style Reference Image

dog

Generated Image

Using a Style Reference

Use an existing image as a Style Reference to guide the look and feel of generated image variations. Style reference can help develop a consistent look across a variety of generated assets.

This feature, along with a Structure Reference, gives you more control of image generation beyond the text prompt.

Specifying strength

To influence how strong your reference image's effect is during the image generation process, add a strength value between 1 and 100 to your style object. When strength isn't specified, it defaults to a value of 50.

Concepts in action

Let's use a style reference image to generate a few image variations.

  1. Open a secure terminal and export your Client ID and Access Token as environment variables:
Copied to your clipboard
export FIREFLY_SERVICES_CLIENT_ID=<your_client_id>
export FIREFLY_SERVICES_ACCESS_TOKEN=<your_access_token>
  1. Save the image of the mountain at the top of this page to your computer's desktop as style-image-reference-mountain.webp. We'll generate a few image variations using this style.

  2. Upload your saved image to Firefly's storage API by calling the endpoint below. Be sure to update the --data-binary path to point to your saved image:

Copied to your clipboard
curl --location 'https://firefly-api.adobe.io/v2/storage/image' \
--header 'Content-Type: image/webp' \
--header 'Accept: application/json' \
--header "x-api-key: $FIREFLY_SERVICES_CLIENT_ID" \
--header "Authorization: Bearer $FIREFLY_SERVICES_ACCESS_TOKEN" \
--data-binary '@/Users/<YOUR_MACHINE_USERNAME>/Desktop/style-image-reference-mountain.webp'

You'll receive a response with an ID that looks like this:

Copied to your clipboard
{"images":[{"id":"0eb8584a-b850-4c4c-a234-185d6378ecb6"}]}
  1. Export the id so that the next script can access it:
Copied to your clipboard
export FIREFLY_UPLOAD_ID=<your_upload_id>
  1. Generate a new image based on the uploaded image:
Copied to your clipboard
curl --location 'https://firefly-api.adobe.io/v3/images/generate-async' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "x-api-key: $FIREFLY_SERVICES_CLIENT_ID" \
--header "Authorization: Bearer $FIREFLY_SERVICES_ACCESS_TOKEN" \
--data '{
"numVariations": 4,
"prompt": "a friendly dog",
"style": {
"imageReference": {
"source": {
"uploadId": "'$FIREFLY_UPLOAD_ID'"
}
}
}
}'

The request returns a rapid response for the asynchronous job:

Copied to your clipboard
{
"jobId":"<YOUR_JOB_ID>",
"statusUrl":"https://firefly-epo854211.adobe.io/v3/status/urn:ff:jobs:...",
"cancelUrl":"https://firefly-epo854211.adobe.io/v3/cancel/urn:ff:jobs:..."
}
  1. Use the jobId to see the result:
Copied to your clipboard
curl -X GET "https://firefly-api.adobe.io/v3/status/<YOUR_JOB_ID>" \
-H "x-api-key: $FIREFLY_SERVICES_CLIENT_ID" \
-H "Authorization: Bearer $FIREFLY_SERVICES_ACCESS_TOKEN" \
-H "Content-Type: application/json"