ImageMagick: turn a Sume WebP into a 1080x1350 JPEG

One magick command resizes to fill, center-crops to 1080x1350 and writes a stripped JPEG. Use it on a Sume 4:5 image whose native size is not exactly 1080x1350.

4 min readSume
All posts

Run magick in.webp -resize 1080x1350^ -gravity center -extent 1080x1350 -quality 90 -strip out.jpg. ImageMagick's command-line guide documents each piece: magick in out for a conversion, -resize WxH^ to scale so the image covers the box, -gravity center with -extent to trim to the exact canvas, -quality for JPEG, and -strip to drop metadata.

You need this because the Sume image docs are explicit that 4:5 is the Instagram portrait ratio, but that native sizes differ by model. For Nano Banana the docs state a native size of about 928x1152 at 1K, and the exact 1080x1350 comes from a documented post-step. If you call the API directly and want exactly 1080x1350, do the last step yourself.

What does each flag do?

Flags from ImageMagick's command-line processing page, read 2026-10-05.
PartRoleWhy it is here
-resize 1080x1350^Scale so both sides are at least the targetCovers the canvas with no empty bars
-gravity centerAnchor for the next geometry operationCrops equally from both sides
-extent 1080x1350Set the final canvas sizeTrims the overflow to the exact size
-quality 90JPEG compression levelSmaller file with little visible loss
-stripRemove profiles and commentsSmaller file, no stray metadata

The command, and a batch loop

Keep the aspect ratio at 4:5 in the request and the crop trims only a few pixels. Requesting aspect_ratio: "4:5" with a model whose catalog lists it is better than cropping a 1:1 image, which throws away a fifth of the picture.

# one file
magick in.webp -resize 1080x1350^ -gravity center -extent 1080x1350 -quality 90 -strip out.jpg

# every WebP in the folder, without touching the originals
for f in *.webp; do
  magick "$f" -resize 1080x1350^ -gravity center -extent 1080x1350 \
    -quality 90 -strip "${f%.webp}.jpg"
done

Check the ratio before you crop

Not every model lists 4:5. The docs say Imagen and Grok do not, and a request with an unlisted value fails with 400 unsupported_parameter instead of silently picking another ratio. Read GET /v1/images/models and look at the aspect_ratio descriptor first.

Whether your ImageMagick build can read WebP depends on how it was compiled, so run magick -list format and look for WEBP before you build a pipeline on it. If it is missing, request output_format: "png" from Sume and skip the WebP step entirely.

One last detail on the order of flags: ImageMagick applies settings and operators as it reads them, so keep -resize, then -gravity, then -extent, as written. Moving -gravity after -extent changes where the crop is anchored, and a wrong anchor on a product photo can cut the product in half.

Sources

Related posts

More in Media tools

All Media tools posts

Written by Sume