Linux: Jpeg Image Optimization / Compress Command

You can use the jpegoptim utility to optimize JPEG images in Linux. You can install jpegoptim using your package manager, for example, in Ubuntu:

# apt-get install jpegoptim

Once installed, you can optimize a JPEG image by specifying the file name as an argument:

# jpegoptim image.jpg

By default, jpegoptim will optimize the image while preserving its visual quality. If you want to reduce the image size even further, you can specify a compression level using the -m option:

# jpegoptim -m75 image.jpg

This will compress the image to 75% of its original size. Note that compressing the image too much may result in a noticeable loss of quality.

Leave a Comment