Skip to content

Batch Resize Images From the Command Line on Windows

Batch resize images from the command line on Windows free using WSL and ImageMagick. Resize a whole folder by width, percentage, or limit, all offline with no uploads.

MGMCSA Guru Team June 13, 2026 4 min read
A WSL terminal batch-resizing a folder of images with ImageMagick mogrify on Windows

Resizing one image is easy anywhere. Resizing four hundred of them — product shots, a photo dump, screenshots for docs — is where a clicky tool falls apart and an online “bulk resizer” wants you to upload the lot. ImageMagick in WSL does the whole folder in one line, for free, without a single file leaving your machine.

The one thing to get right is which command you use: mogrify is fast but overwrites originals, while magick/convert is safer because it writes new files. This guide covers both, plus the resize syntax that controls exactly what happens.

No WSL yet? See the WSL install guide.

Install ImageMagick

sudo apt update && sudo apt install -y imagemagick

Check it:

magick -version

On older versions the command is convert and the batch tool is mogrify; both are part of ImageMagick.

The resize syntax (the part that matters)

ImageMagick’s -resize takes a geometry string. Getting this right is most of the job:

-resize geometry operators

800x600 Fit inside 800x600, keep aspect ratio
800x Width 800, height scales to match
x600 Height 600, width scales to match
50% Scale to 50% of original
800x600! Force exact size (may distort)
1600x1600> Only shrink images larger than this
800x600^ Fill the box, then you can crop

The two you’ll use most are a single dimension (keeps the ratio) and the > operator (only shrinks, never upscales).

Safe batch resize (writes new files)

This keeps your originals. It resizes every JPG in the current folder to 800px wide and writes the result into a resized subfolder:

mkdir -p resized
for f in *.jpg; do magick "$f" -resize 800x "resized/$f"; done

Because each output goes to resized/, your source files are never touched. Swap 800x for any geometry from the table — 50%, x600, 1600x1600>, and so on.

Fast in-place batch with mogrify

mogrify is built for exactly this and doesn’t need a loop — but it overwrites the originals, so work on a copy:

cp -r originals/ work/ && cd work/
mogrify -resize 1600x1600> *.jpg

That resizes every JPG larger than 1600×1600 down to fit, and leaves smaller ones alone — ideal for taming a folder of oversized photos in one pass.

Resize and convert at the same time

mogrify can change format while resizing. To resize and output WebP in one step:

mogrify -path resized -format webp -resize 1200x *.jpg

-path resized sends output to that folder (create it first), and -format webp writes .webp files — so this also leaves your JPGs intact. To go further with WebP, see convert JPG to WebP.

A practical web-image workflow

For a folder of camera photos you want web-ready — capped size and stripped metadata:

mkdir -p web
for f in *.jpg *.jpeg; do [ -e "$f" ] && magick "$f" -resize 1600x1600> -strip -quality 85 "web/${f%.*}.jpg"; done
  • -resize 1600x1600> caps dimensions without upscaling.
  • -strip removes metadata (smaller file, and clears GPS — see remove image metadata).
  • -quality 85 keeps photos clean at a smaller size.
  • Output lands in web/, originals untouched.

Wrapping up

Batch resizing on Windows is one ImageMagick line away. Use a magick loop into a separate folder when you want your originals safe, or mogrify (on a copy) when you want the fastest in-place pass. The geometry string does the work: a single dimension keeps the ratio, and > shrinks without upscaling.

It’s free, it clears whole folders at once, and it all runs in WSL — so nothing gets uploaded. Pair it with stripping and quality settings and you’ve got a repeatable web-image pipeline in a single command.

Frequently asked questions

What's the difference between mogrify and convert for resizing?

mogrify edits files in place and is built for batches, so it can resize a whole folder in one command — but it overwrites the originals. convert (or magick) reads one file and writes a new one, which is safer because it leaves the source untouched.

How do I resize images but keep the aspect ratio?

Give only one dimension, like -resize 800x, and ImageMagick scales the other side proportionally. Using -resize 50% also keeps the ratio. You only distort an image if you force exact dimensions with the ! operator.

How do I shrink large images but leave small ones alone?

Add the > operator, as in -resize 1600x1600>. ImageMagick only resizes images larger than that box and skips anything already smaller, so you don't accidentally upscale small files.

Do these tools upload my images anywhere?

No. ImageMagick runs locally in WSL, so resizing happens entirely on your machine. Nothing is uploaded, which is the main reason to use it over an online bulk resizer for private images.

Will resizing reduce image quality?

Shrinking an image is generally clean and often looks fine or better at the smaller size. Enlarging past the original resolution adds no real detail and softens the image, so avoid upscaling when you can.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.