Generative AI Reference Images

Generate Images Using Reference Image

Many of the Getty Images Generative AI endpoints use a reference image to influence the generated results. Below are examples of using reference images from a variety of sources. Further documentation for each endpoint can be found on Swagger.

Get Access Token

In order to generate images you will need to use Client Credentials or Authorization Code to obtain an access token, and then include that token in all calls.

Image Generation using a Previously Generated Image

A previously generated image can be used as a reference image. To reference a previously generated image, the client will need the generation_request_id and the index of the image to reference. These details can be retrieved using the GET /v3/ai/generation-history endpoint.

Image Generation Request

curl -X POST \
  "https://api.gettyimages.com/beta/ai/image-generations/influence-composition-by-image" \
  -H "accept: application/json" \
  -H "Api-Key: <YOUR_API_KEY>" \
  -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
  -d "{
        'reference_generation': {
            'generation_request_id': 'generation_request_id',
            'index': 1
        },
        'prompt': 'Prompt Text',
        'influence_level': 0.5
    }"

Image Generation Response

The response code can be either HTTP status code 200 or 202. Examples can be found in this section.

Image Generation using a Getty Images Creative Asset

A Getty Images Creative Asset can be used as a reference image. Before using a Getty Images Creative Asset as a reference image, it must first be licensed (downloaded) through a traditional license product such as Premium Access. One way to license is to download the image using the POST /v3/downloads/images/{id} endpoint. If there are questions on how to license a Getty Images Creative Asset, please contact your sales representative.

Image Generation Request

curl -X POST \
  "https://api.gettyimages.com/beta/ai/image-generations/influence-composition-by-image" \
  -H "accept: application/json" \
  -H "Api-Key: <YOUR_API_KEY>" \
  -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
  -d "{
        'reference_asset_id': 'id',
        'prompt': 'Prompt Text',
        'influence_level': 0.5
    }"

Image Generation Response

The response code can be either HTTP status code 200 or 202. Examples can be found in this section.

Image Generation using a Registered File

A client’s image can be used as a reference image. In order to use a client’s image, the image must first be uploaded and registered. Details on that process can be found in this section. After successfully registering the image, a file_registration_id will be returned.

Image Generation Request

curl -X POST \
  "https://api.gettyimages.com/beta/ai/image-generations/background-generations" \
  -H "accept: application/json" \
  -H "Api-Key: <YOUR_API_KEY>" \
  -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
  -d "{
        'reference_file_registration_id': 'file_registration_id',
        'prompt': 'Prompt Text'
    }"

Image Generation Response

The response code can be either HTTP status code 200 or 202. Examples can be found in this section.

Uploading and Registering a Rights Claimed Image

When using a client’s image as a reference image, it must first be uploaded and registered in our systems. Once the image is successfully registered, a file_registration_id will be returned.

Uploading an Image

Clients can upload images to https://api.gettyimages.com/v3/search/by-image/uploads/{CLIENT_IMAGE.jpg}, where the client defines the {CLIENT_IMAGE.jpg} portion of the URL. Uploads to the same URL will overwrite each other, so ensure that the client application is handling naming uniqueness appropriately.

Image Upload Request

curl -i -X PUT 
  "https://api.gettyimages.com/v3/search/by-image/uploads/my-test-image.jpg" \
  -H "Content-Type: image/jpeg" \
  -H "Api-Key: <YOUR_API_KEY>" \
  --data-binary "@testimage.jpg"

Image Upload Response

A successful response returns HTTP status code 200 with no body. The request URL (https://api.gettyimages.com/v3/search/by-image/uploads/{CLIENT_IMAGE.jpg}) will be used to reference the upload on other endpoints.

Registering an Uploaded Image

After an image has been uploaded (details in this section), the file can be registered. This registration is required to use the image as a reference image for image generations.

File Registration Request

The url in the request is the URL that was used when uploading the image. The rights_claimed must be set to true and is acknowledgment that client owns or has a license for this file.

curl -X POST \
  "https://api.gettyimages.com/beta/ai/file-registrations" \
  -H "accept: application/json" \
  -H "Api-Key: <YOUR_API_KEY>" \
  -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d "{
        'url': 'https://api.gettyimages.com/v3/search/by-image/uploads/{CLIENT_IMAGE.jpg}',
        'rights_claimed': true
      }"

File Registration Response

The id can be used as the reference_file_registration_id in subsequent image generation requests.

{
  "id": "string"
}