AI ad resizer: one image, several aspect ratios, one API

Sume has no resizer button. Send the same source image to POST /v1/images once per aspect_ratio (1:1, 4:5, 9:16, 16:9) and recompose each ad slot.

4 min readSume
All posts

An AI ad resizer on Sume is a loop of edit calls: send the same source image to POST /v1/images once for each aspect_ratio you need, with a prompt that says to keep the subject and recompose the scene. Each call returns a new image in that ratio, not a crop of the old one.

Everything here comes from the Image API docs, read 2026-09-30. The docs do not describe an outpaint or smart-crop mode, so quality of the recomposition depends on the model and prompt you pick.

Which aspect ratios can I ask for?

The normalized list in the docs is 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 4:5, 5:4, 1:2, 2:1, 1:4, 4:1, 1:8, 8:1, 9:21 and 21:9. A model only accepts the values its catalog descriptors list, so read supported_parameters for your model before pinning a ratio.

Common ad slots and the aspect_ratio value to request, from the Image API docs, read 2026-09-30
Slot shape`aspect_ratio`In the docs list?
Square feed1:1Yes
Portrait feed4:5Yes
Full-screen vertical9:16Yes
Landscape banner16:9Yes
Wide strip21:9Yes

How do I send one source image for several sizes?

Put the source in input_references and change only aspect_ratio per call. Reference URLs must be public HTTPS; localhost, private-network and non-HTTPS URLs are rejected before submission.

const ratios = ["1:1", "4:5", "9:16", "16:9"];

const results = await Promise.all(
  ratios.map(async (aspect_ratio) => {
    const res = await fetch("https://api.sume.com/v1/images", {
      method: "POST",
      headers: {
        Authorization: "Bearer " + process.env.SUME_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        model: "openai/gpt-image-2",
        prompt: "Keep the product and colors; recompose the scene for this frame",
        input_references: [
          { type: "image_url", image_url: { url: "https://example.com/ad.png" } },
        ],
        aspect_ratio,
      }),
    });
    return { aspect_ratio, body: await res.json() };
  }),
);
console.log(results);

Why not use n for the different sizes?

n requests up to 10 images per call, but one call carries one aspect_ratio. It gives you variations of one shape, which is useful for picking the best of several tries in a single ratio. Per-model ceilings on n are lower, so read the n range descriptor from the catalog.

When should I use aspect_ratio auto?

Use auto when you want the output to keep the source's shape, for example a color or copy edit. The docs say that on edit and image-to-image calls you should prefer aspect_ratio: "auto" to match the reference, and that omitting the field is not the same as auto. For resizing you want the opposite, so always pass an explicit ratio. A related page covers the options for each model: image API aspect ratios and custom sizes.

What should I check before shipping the set?

Compare each output against the source: logos, product shape and any text. Regenerated scenes can change small details, and the docs make no promise of pixel fidelity. Check each ad network's own size specs separately; this page does not state them.

Sources

Related posts

More in Use cases

All Use cases posts

Written by Sume