Edit in GitHubLog an issue

Structure Image Reference

Use Structure Image Reference to generate images based on a specific outline and depth

mountain

Structure Image Reference

volcano

Generated Image

Overview

Use structure.imageReference with Firefly's Generate Images API to generate images based on a specific outline and depth. This is helpful for when you have a scene where everything in it is placed correctly, but you want to generate a new image with a different details, style, or mood.

Prerequisites

If you don't already have a Firefly Client ID and Access Token, learn how to retrieve them in the Authentication Guide before reading further. Securely store these credentials and never expose them in client-side or public code.

Specifying Strength

To influence how impactful your reference image is during the image generation process, add a strength value between 1 and 100 to your structure object. When "strength" is not specified, it defaults to a value of 50.

Experience Structure Image Reference in Action

First, open a secure terminal and export your Client ID and Access Token as environment variables:

Copied to your clipboard
export FIREFLY_SERVICES_CLIENT_ID=yourClientIdAsdf123
export FIREFLY_SERVICES_ACCESS_TOKEN=yourAccessTokenAsdf123

Next, save the image of the mountain to your computer's Desktop.

Next, upload your saved image to Firefly's storage API:

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/PLACEHOLDER_FOR_YOUR_MACHINE_USER_NAME/Desktop/structure-image-reference-mountain.webp'

You will receive a response that looks like this:

Copied to your clipboard
{"images":[{"id":"0eb8584a-b850-4c4c-a234-185d6378ecb6"}]}

Export it so that the next script can easily access it:

Copied to your clipboard
export FIREFLY_UPLOAD_ID=asdf123YourUploadIdFromPreviousStep

Finally, generate a new image based on the uploaded image:

Copied to your clipboard
curl --location 'https://firefly-api.adobe.io/v3/images/generate' \
--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 photo of a volcano",
"structure": {
"strength": 100,
"imageReference": {
"source": {
"uploadId": "'$FIREFLY_UPLOAD_ID'"
}
}
}
}'
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.