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.

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?
| Part | Role | Why it is here |
|---|---|---|
-resize 1080x1350^ | Scale so both sides are at least the target | Covers the canvas with no empty bars |
-gravity center | Anchor for the next geometry operation | Crops equally from both sides |
-extent 1080x1350 | Set the final canvas size | Trims the overflow to the exact size |
-quality 90 | JPEG compression level | Smaller file with little visible loss |
-strip | Remove profiles and comments | Smaller 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"
doneCheck 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
- Media import allows about 2 GB, but trim and filter stop at 300 MiB
Sume media import has a practical size cap near 2 GB, while video trim and filter reject sources over 300 MiB with source_too_large. How to plan around the gap.
- invalid_segment_timing: the two causes in a 3-minute Short timeline
invalid_segment_timing means a slot start is not after the previous start, or a slot ends over 0.5 s past audio.duration_seconds. Check starts, then ends.
- Is a reference Short silent? Reference ingest audio gate at -60 LUFS
Reference ingest marks audio.silent when integrated loudness is -60 LUFS or lower. Silent means plan new music and skip STT; the manifest also reports beats.
- Is this video stereo or mono? Read probe audio_channels first
Sume video inspect returns audio_channels, audio_sample_rate and audio_codec. Use them to choose channels and sample_rate for audio detach before you submit.
Written by Sume