· Design My Website · Images  · 1 min read

Compress images on Mac with ImageMagick

How to batch compress a whole folder of JPEG and PNG images on Mac using ImageMagick mogrify commands in Terminal, keeping your original files untouched.

Download: https://imagemagick.org/script/download.php

To compress a folder full of images using ImageMagick on Mac, you can use the command line to batch process all images in that folder. Here’s a step-by-step guide:

  1. Open Terminal on your Mac.
  2. Navigate to the folder containing your images using the cd command. For example:textcd /path/to/your/images
  3. Run a loop command that compresses each image. For JPEG images, you can use:textmagick mogrify -quality 75 -path compressed_folder *.jpg This will compress all .jpg images in the folder to 75% quality and save the compressed images into a subfolder named compressed_folder. You can create this folder first using mkdir compressed_folder.
  4. To compress PNG images, you could adjust the compression level like:textmagick mogrify -path compressed_folder -format png -define png:compression-level=9 *.png
  5. You can adjust the -quality parameter to control the compression level (lower means smaller file size but reduced quality).

Summary of key commands:

  • Navigate to folder:textcd /path/to/images
  • Create output folder:textmkdir compressed_folder
  • Compress JPEGs:textmagick mogrify -quality 75 -path compressed_folder *.jpg
  • Compress PNGs:textmagick mogrify -path compressed_folder -format png -define png:compression-level=9 *.png

This approach processes all images in bulk efficiently and keeps originals untouched by saving compressed files separately. You can change extensions, quality, and output folder as needed for your specific use.​

    Share:

    About the author

    Tommy O'Shea

    Tommy owns and runs Design My Website, a web design studio in Kilcummin, Co. Kerry. He has built and maintained over 100 websites for businesses across Kerry, Cork and Ireland over the last 13 years.

    More about Design My Website →

    Back to Blog

    Related Posts

    View All Posts »