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.

4 min readSume
All posts

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.

Google's recommended image sizes against Sume custom-size rules, read 2026-09-30.
RatioGoogle recommendsMultiples of 16?Request
1:11200x1200Yes1200x1200
4:5960x1200Yes960x1200
1.91:11200x628No (628 is 39.25 x 16)1200x640, then crop 6 px top and bottom
9:161080x1920No (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

All Developers posts

Written by Sume