How to Install Jpegoptim on Ubuntu 20.04

Install Jpegoptim on Ubuntu 20.04

In this article, we will have explained the necessary steps to install Jpegoptim on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Jpegoptim is a command-line utility that helps compress and optimize jpg. Jpegoptim can help you in compressing your jpegs, jpg, and jfif files with and without quality loss, depending on what you are looking for.

Install Jpegoptim on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install Jpegoptim on Ubuntu Linux.

Installing Jpegoptim on your Ubuntu Linux system is straightforward, Now we Run the following command to install the Jpegoptim on the Ubuntu desktop:

sudo apt install jpegoptim

You can check the version number of the application, and also verify that it is indeed installed on your system, through the following command:

jpegoptim --version

Step 3. Using Jpegoptim.

After successful installation, To compress an image using Jpegoptim without losing the original quality, the syntax is as follows:

jpegoptim image-file.jpeg

We can also specify file size in either kilobyte (k) or as a percentage (%) and, just to confuse things we’ll need to tell the app that it can overwrite the previous attempt to compress it:

jpegoptim --size=100k image-file.jpeg --overwrite

To see a full list of options and usage instructions for this utility see the Ubuntu manpage by running:

man jpegoptim

That’s all you need to do to install Jpegoptim on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on the Install Jpegoptim, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.