How to compress a JPG file to 100 KB in MacOS?

How to compress a JPG file to 100 KB in MacOS?

To compress a JPG file to 100 KB on macOS, you can use built-in tools like Preview, or command-line tools such as ImageMagick or ffmpeg. Here’s how you can do it using these different methods:

Before we begin, we want to let you know you can use https://www.xconvert.com/compress-jpeg to compress your JPG to 100KB online. You can choose Autoscale feature to keep the quality high while reducing file size to less than 100KB.

1. Using Preview (Built-in macOS App)

Preview is a built-in app on macOS that provides a simple way to compress images:

  1. Open the Image in Preview:
  • Right-click on your JPG file and select Open With > Preview.
  1. Export the Image:
  • Go to File > Export.
  • In the dialog that appears, select JPEG as the format.
  • Adjust the Quality slider while keeping an eye on the file size shown at the bottom of the dialog. Lower the quality until you reach around 100 KB.
  1. Save the Compressed Image:
  • Click Save to save the compressed file.

2. Using ImageMagick on the Command Line

ImageMagick is a powerful command-line tool that can be used to compress and resize images. You need to install it first if you haven’t already.

Install ImageMagick:

You can install ImageMagick using Homebrew (a package manager for macOS):

  1. Install Homebrew (if you don’t have it already):
   /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install ImageMagick:
   brew install imagemagick

Compress the JPG File:

Once ImageMagick is installed, you can use the convert command to compress the image:

convert your-image.jpg -quality 80 -resize 1024x768 compressed-image.jpg
  • -quality 80: Sets the image quality to 80%. Lower the number to reduce the size further.
  • -resize 1024x768: Resizes the image to a maximum of 1024×768 pixels (adjust dimensions as needed).

Repeat this process, lowering the quality or size until the image is under 100 KB.

3. Using ffmpeg on the Command Line

ffmpeg is another powerful tool that can be used to compress images, but it must be installed first.

Install ffmpeg:

  1. Install ffmpeg using Homebrew:
   brew install ffmpeg

Compress the JPG File:

Use the following command to compress the image:

ffmpeg -i your-image.jpg -q:v 31 compressed-image.jpg
  • -q:v 31: Sets the quality for the output image. Higher values reduce the file size but may lower the quality. Adjust the value as needed.

4. Checking the File Size

After compressing the image, check the file size in Finder or use the command line:

ls -lh compressed-image.jpg

Additional Tips:

  • Iterate to Find the Right Balance: You may need to adjust the quality multiple times to reach exactly 100 KB while retaining acceptable visual quality.
  • Batch Compression: If you have multiple images, you can use a script to automate the compression for all files in a directory.

Featured photo by Alexander Andrews on Unsplash