Skip to the tool workspace
Browser 143

Handleidingen Images

How to resize images

Resize an image without stretching it or making it soft. The aspect-ratio maths, why shrinking is safe and enlarging is not, and the one-line commands.

Resizing sounds like one number. Then it turns out to be two numbers that have to agree, and making an image bigger is a different job from making it smaller.

The direct waysips (macOS) · ImageMagickmacOS · Linux · Windows

macOS has a resizer built in, no install required. -Z fits the image inside a box on its longest edge, keeping the aspect ratio:

sips -Z 1200 photo.jpg --out photo-small.jpg

With ImageMagick, on any platform:

magick photo.jpg -resize '1200x1200>' photo-small.jpg

The > inside the quotes means "only if it is bigger", so running it over a folder never enlarges the small ones by accident.

Keep the ratio, or accept the squash

Every image has an aspect ratio. Set the width and height separately and you will break it. A 4000 × 3000 photo (4:3) forced into a 1200 × 1200 square comes out visibly squashed.

The answer is to set one dimension and let the other follow:

new height = original height × (new width ÷ original width)
3000 × (1200 ÷ 4000) = 900

So 4000 × 3000 becomes 1200 × 900. Every command and tool on this page does that sum for you. It is only worth knowing so you can spot it when a tool gets it wrong.

If you really need a square from a rectangle, crop it instead of resizing. Cropping cuts off the parts that do not fit. Resizing distorts everything to make it fit.

Down is safe, up is not

Downscaling throws pixels away. The resampler averages neighbouring pixels into one. That has a clear right answer, and the result looks correct.

Upscaling has no extra detail to work with, so it makes up pixels by blending the ones it has. That looks soft. Doubling is sometimes fine. Quadrupling looks like exactly what it is.

Resize from the original every time

Keep the full-size file. A 400px thumbnail made from an 800px copy of a 4000px original gets softened twice. Going back to the original costs nothing and looks better.

Sizes that are actually useful

Use Long edge
Thumbnail 300–400px
Blog image, in the text column 1200–1600px
Full-width hero 2000px
Print, at 300 DPI width in inches × 300

Web sizes assume high-density screens, which need roughly double the displayed size. That is why a 700px-wide column still wants a 1400px image.

Batch a folder
  1. Work on a copy of the folder, not the originals.
  2. Decide the long edge from the table above, and use a "shrink only" flag so already-small files are left alone.
  3. Resize first, then compress. Compressing first is wasted effort, because the resize re-encodes the file anyway.
  4. Spot-check the smallest and the most detailed result, not just the first one.

With ImageMagick, that whole loop is one line:

magick mogrify -path ./resized -resize '1600x1600>' ./originals/*.jpg

mogrify -path writes to a different folder, which stops it overwriting your originals.

Then make it smaller still

Resizing is the biggest single saving, but the file can usually shrink further with no visible change. That is compression, and it is a separate step.

Questions people ask

Why does my resized image look soft?

Because you enlarged it. There is no extra detail to recover, so the resampler makes up pixels by averaging the ones it has, and averaging looks like blur. Shrinking is safe. Avoid enlarging where you can.

What size should a web image be?

Twice the largest size it will be shown at, up to about 2000px on the long edge for a full-width photo. Doubling covers high-density screens. Anything bigger is bytes nobody sees.

Does resizing reduce file size?

Yes, a lot. It is the most effective single change you can make. Halving both dimensions removes three quarters of the pixels.

How do I resize without distorting the image?

Set one dimension and let the other follow. Every tool here does this by default. You only get distortion when you force both numbers yourself.

Tools in deze handleiding

Alles draait op je apparaat

Alle handleidingen First published 20 jan. 2025