Download image
This document will introduce how to download the generated result image without using our SDK.
Task Object
The task object looks like it will be the following struct.
When the status of the task is completed, task.outputs
will have a value that contains the result. You can notice that there is a mediaId
field in the outputs
object. This mediaId
is the ID of the generated image. For batch generation scenarios, the IDs of multiple images will be outputs.batch[].mediaId
.
Get the image download link
After obtaining the mediaId, you need to use our GraphQL API to obtain the specific image download link. You need to access the Query.media
query and pass the mediaId
as the parameter. And you should access the Media.urls
field to get the download link.
The variant
field in the Media.urls
object is the type of the image. The url
field is the download link of the image.
We will provide multiple variants of the image at the same time. If you want to access the original image after generation, you usually need to select the URL which variant
is PUBLIC
.
You can use a GraphQL batch query to fetch multiple images at once. The GraphQL query similar to belows.