Compress JPEG Images on Linux Using Terminal


In Linux JPEG compression is a manner for decreasing the file measurement of digital photographs at the same time sustaining their high quality. The Linux terminal provides a number of instruments for compressing JPEG photographs, resembling the “jpegoptim” command. Using this device, we will optimize our photographs for completely different utilization by decreasing their measurement devoid of shedding picture high quality.

Note: Here we’ve used a JPG format picture nonetheless equally the JPEG and JPG are the identical. This device can convert any of them.

How to Install jpegoptim on Linux

To set up the jpegoptim device run the subsequent command:

$ sudo apt-get set up jpegoptim

We have a check picture with a measurement of three.1MB. Now we’ll compress this picture utilising the jpegoptim device.

We may also examine picture measurement utilising the record command:

Compressing Image Using jpegoptim to an Optimize Value

To compress the picture run following command:

Here we will see the picture is compressed a bit by 0.23%. This is auto compression by jpegoptim device.

However, we may also outline the scale at which we would like to compress the picture.

Compressing Image to a Specific Size

Run the under command to compress the picture from 3mb to roughly 1mb file. You may also outline a customized file measurement.

$ jpegoptim –size=1000k picture.jpg

Terminal exhibits picture measurement decreased from 3mb to 1mb.

Compressing and Save Image to a Specific Destination

To compress picture to a distinct vacation spot run given command:

$ jpegoptim –size=800k picture.jpg –dest ~/Desktop

This command will decrease picture measurement to roughly 800 kb and save the file on Desktop.

To affirm the picture conversion, we will record the Desktop documents:

Optimizing Several Images at a Time

To optimize a number of photographs run the given command:

$ jpegoptim image1.jpg image2.jpg image3.jpg

Batch Process an Entire Folder of Images

To batch procedure a whole folder of jpg photographs run the command:

$ jpegoptim ~/Pictures/picture/*.jpg

To locate additional info and full record of choice about jpegoptim device run the given command:


The JPEG compression in Linux might possibly be performed utilising the jpegoptim device inside the terminal. This promises a easy and competent method to optimize JPEG photographs for net utilization, decreasing file measurement at the same time sustaining picture high quality.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More