Demand Gen image assets in every ratio from one reference
Loop one product reference through POST /v1/images to get the 1:1, 4:5, 9:16 and 1.91:1 Demand Gen image sizes, with notes on which pixel sizes are valid.

Run one loop over four sizes and pass the same product photo as an input_references entry each time. Google's Demand Gen spec, read 2026-09-30, lists 1:1, 1.91:1, 4:5 and 9:16 images, and its September 24 2026 update adds one-click image ads on 9:16 full-bleed in Shorts.
Which size do I request for each ratio?
Two of Google's four recommended sizes cannot be sent as written, because custom pixels must be multiples of 16. The table shows the nearest sendable neighbor.
| Ratio | Google recommends | Multiples of 16? | Request |
|---|---|---|---|
| 1:1 | 1200x1200 | Yes | 1200x1200 |
| 4:5 | 960x1200 | Yes | 960x1200 |
| 1.91:1 | 1200x628 | No (628 is 39.25 x 16) | 1200x640, then crop 6 px top and bottom |
| 9:16 | 1080x1920 | No (1080 is 67.5 x 16) | 1088x1920, then crop 4 px per side |
What does the loop look like?
Each request gets its own Idempotency-Key. Responses are jobs; the default mode is async, so store the returned job id and poll it.
const sizes = ["1200x1200", "960x1200", "1200x640", "1088x1920"];
const ref = "https://cdn.example.com/product.png";
for (const image_size of sizes) {
const res = await fetch("https://api.sume.com/v1/images", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.SUME_API_KEY,
"Content-Type": "application/json",
"Idempotency-Key": "dg-set-" + image_size + "-v1",
},
body: JSON.stringify({
model: "openai/gpt-image-2.5",
prompt: "Product on a clean background, same product as the reference",
input_references: [{ type: "image_url", image_url: { url: ref } }],
image_size,
output_format: "png",
}),
});
console.log(image_size, res.status, await res.json());
}Why not keep aspect_ratio auto on edits?
The docs advise aspect_ratio: "auto" for edits so the output matches the reference, and say omitting the field is not the same as auto. Here you want fixed shapes, so you set image_size instead, which wins over aspect_ratio. The cost is that a very different reference shape may need a prompt that says how to recompose.
What should I check before uploading?
Open each result and check composition at every ratio; a centered product in 1:1 can sit too high in 9:16. Check Google's own file rules from the snapshot (.jpg or .png, 5 MB for images). For larger runs, see bulk image generation.
Sources
Related posts
More in Developers
- Does a failed Sume video job send a webhook to callback_url?
Yes. A job that ends in failure sends job.failed with a public error to the HTTPS callback_url you set on POST /v1/videos, signed like every Sume webhook.
- Get the rendered MP4 back from a video editing API job
Descript's API lists no rendered file download without publishing. In Sume, a finished timeline_render job result carries video_url; here is the poll flow.
- Durable Object waitUntil keep-alive and a Sume job poll
Pending I/O now keeps a Durable Object alive without a client, but a Sume video job is better tracked by job id, status_url polling or a webhook.
- Edit a transcript with an AI instruction: Sume's STT flow
ElevenLabs STT accepts an edit instruction and returns edited_transcript. Sume's STT has no such field: it returns text and word timings to edit yourself.
Written by Sume