Implement computer vision solutions 3.1 Design and implement image- and video-generation solutions
A web store generates product images from text prompts with a gpt-image-1 deployment…
Study guide skill: Implement a solution that generates images from text prompts and reference media
Question B3-019
A web store generates product images from text prompts with a gpt-image-1 deployment (limited access preview). Each image needs a transparent background so it can sit on any page color. How should you configure the image generation request?
Select one answer.
Answer: C
To get a transparent background, set the background parameter to transparent and output_format to PNG on the image generation request. WEBP output isn't supported in Azure OpenAI in Foundry Models. GPT-image-1 series models don't support response_format and always return base64-encoded images, and quality (low, medium, or high) sets the image quality level rather than the background.
Deep dive
How it works
Transparent backgrounds are a request setting on GPT-image-1 series image generation, and they come with a format dependency. The image generation page's samples show it: background accepts auto or transparent, and transparent requires PNG output. So the request needs two settings together:
- background set to transparent.
- output_format set to png. The documented output_format values are png and jpeg.
Two related facts help with the other options. GPT-image-1 series models always return images as base64 (the response carries b64_json), and the response_format parameter isn't supported for them. And output_compression (0 to 100) applies to JPEG only, which is another reason PNG is the format for cut-out product images.
A sample request body would include the prompt, size, quality, "output_format": "png" and "background": "transparent". Decode the base64 data and save it as a .png file.
The other options, and when you'd use them
- response_format set to url: response_format isn't supported for GPT-image-1 series models, which always return base64-encoded images. There's no URL option.
- output_format set to WEBP: The documented output formats are png and jpeg, and transparency requires PNG.
- quality set to low: Quality trades detail for speed; low is optimized for latency-sensitive use cases. It has no effect on the background.
Exam tip
Transparent image = background: transparent + output_format: png. GPT-image-1 series = base64 only, so no response_format.
References
Last reviewed: