How to compress all the photos in a folder from the command line
Install fixmint, open a terminal in the folder with your photos and run fixmint compress "*.jpg" --max 200KB. Every photo bigger than 200 KB is saved again at the best quality that fits under the limit, as a new file with -small added to its name. Smaller photos are left alone and your originals are never touched. Everything runs on your computer, with no upload.
Install fixmint on Windows, Mac or Linux
fixmint is one small program with twenty commands, for Windows, macOS and Linux on x86-64 and ARM64. It makes no network connections while you use it. Pick your system.
Windows, in PowerShell:
irm https://fixmint.cc/dl/install.ps1 | iex
macOS and Linux, in a terminal:
curl -fsSL https://fixmint.cc/dl/install.sh | sh
Debian and Ubuntu, after downloading the package from the command-line page:
sudo apt install ./fixmint_1.0.0_amd64.deb
The installers check the download against the published SHA256SUMS list before they install it. Afterwards fixmint version prints the version; if the command is not found, open a new terminal window first. Every command has a short name (compress, resize, convert) and its own help, such as fixmint help compress-image.
Compress every photo in a folder to a size limit
Go to the folder, then run:
fixmint compress "*.jpg" --max 100KB -o smaller/
This is what four photos looked like in a test:
✓ room-tall-1300.jpg 311 KB → 99.0 KB 68% smaller room-tall-1300.jpg (quality 47)
✓ room-tall-900.jpg 180 KB → 98.8 KB 45% smaller room-tall-900.jpg (quality 83)
✓ room-wide-1600.jpg 136 KB → 95.1 KB 30% smaller room-wide-1600.jpg (quality 89)
✓ room-wide-2560.jpg 285 KB → 99.3 KB 65% smaller room-wide-2560.jpg (quality 45)
Total 911 KB → 392 KB 57% smaller
Put the pattern in quotes. Windows shells do not expand *.jpg for a program, so fixmint expands it itself, and quotes give the same result on every system. For compress, a folder name alone is refused with "is a directory", so name the files with a pattern.
-o smaller/ writes the results into a folder called smaller. Without -o, each result is saved next to its original, named photo-small.jpg. A photo that is already under the limit is skipped, and a note says so.
What the quality number and the size limit mean
JPEG quality is a scale from 1 to 100. Higher keeps more detail and gives bigger files, and low values show blocky edges and smeared colour. Without --max, fixmint uses 80, or the value you give with -q 70. With --max, you do not choose: fixmint finds the highest quality that fits, and if quality alone cannot reach the limit, it also makes the picture narrower. The result above shows the trade: the 2560-pixel photo needed quality 45 to reach 100 KB, while the 1600-pixel one managed 89.
One detail matters for forms. fixmint counts a kilobyte as 1,024 bytes, so --max 100KB means 102,400 bytes. In the test above one result was 101,660 bytes. A website that counts 1 KB as 1,000 bytes would call that too big. If a form says 100 KB, ask for --max 90KB. How to get a photo under 100 KB explains what really controls file size.
Resize a whole folder
File size depends mostly on pixel count. Fewer pixels, much smaller file. To make every photo 1,600 pixels wide:
fixmint resize "*.jpg" --width 1600 -o resized/
Shape is kept: the height follows. --percent 50 halves both sides, --height sets a height, and --exact with both stretches to exactly that size. Without -o, the new file is named with its size, such as room-wide-2560-1200x670.jpg. In the test, a 2560-pixel photo of 285 KB became 38.7 KB at 800 pixels wide.
One catch: resize --width 1600 also enlarges a photo that is narrower. A 1300-pixel photo came out at 1600. To shrink only the large ones, use the width option of compress, which means "never wider than":
fixmint compress "*.jpg" --width 1600 --max 200KB -o web/
Here the 1300-pixel photo kept its width, and the 2560-pixel one came out at 1600. Resizing images for forms covers pixels, DPI and aspect ratio.
Convert WebP or PNG to JPG
fixmint convert "*.webp" --to jpg -o jpg/
Each file keeps its name with a new extension. Use --to png for PNG, and -q to set the JPEG quality, 90 by default. Two things to know:
- JPG can be bigger. WebP is the more efficient format. A 28 KB WebP became a 95 KB JPG, so you often compress the converted folder afterwards with
fixmint compress "jpg/*.jpg" --max 200KB -o small/. See JPG vs PNG vs WebP. - Transparency goes white. JPG cannot be see-through. In a test a PNG with a transparent half came out with white where it had been clear. Why a transparent PNG turns black or white explains it. If you need transparency, convert to PNG. For a file that will not open, see why a WebP will not open.
Your originals stay untouched
Every command writes new files and never changes the input: -small for compress, a size such as -1200x670 for resize, and -converted for convert when the name is taken. Compress and resize also refuse to overwrite a result that exists. They print "already exists (use --force to replace it)" and stop. Add --force only when you mean it.
The pattern *.jpg also matches the -small files from an earlier run. Running it again then fails with "would overwrite an input". Send results to a folder with -o and the problem goes away.
One file, once: use the browser
For a single photo, compress it in the browser, resize it or convert it. Nothing is uploaded there either. The commands win when you have a folder, or the same job every week. All three are listed with their examples under compress-image, resize-image and convert-image on the command-line page. To remove the GPS location from photos before you share them, see how to remove location data.
Know someone with the same problem? Send them this article.
Comments
No comments yet. Be the first.



