Generative AI Refine
Refine
Refine is currently in beta. Image quality may vary when refining.
The process of refining, often called “inpainting” on other platforms, allows users to mask a region of a previously generated image, or an image from the Getty Images creative library (excluding illustrations, fine art and vectors), and then fill in the region with content described via a text prompt. The mask needs to be made of black and white areas, where white defines the area to be refined and black defines the area to remain untouched. For the best results, the 1K downloadable file should be used to create the mask.
Use of this endpoint is restricted to clients with an AI Generation license product and may result in the deduction of a credit depending on the terms of your license. Refining an image from the Getty Images creative library also requires a traditional license product, such as Premium Access, that provides download access to the creative image. Lastly, refining an image from the library requires the client to first download the image.
Refer to Swagger for full technical documentation refining generated images and refining images from the Getty Images creative library.
Uploading a mask
Before calling the refine endpoint, a mask in JPG format must be uploaded 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. For example, using cURL:
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: API_KEY' --data-binary "@testimage.jpg"
Once the mask has been uploaded, use the full URL as the mask_url.
You may find it easier to test this by uploading your mask by using the upload endpoint on our Swagger page
Refer to Swagger for full technical documentation of the refine endpoint
Example
In this example, we’re going to replace this simple volleyball with a soccer ball.
Initial image generation parameters:
{
"prompt": "white volleyball on a sandy beach, realistic"
}
Generated Image:
Mask:
Refine Parameters:
{
"prompt": "soccer ball",
"mask_url": "https://api.gettyimages.com/v3/search/by-image/uploads/refine-volleyball-mask"
}