Table of Contents
This article will guide you how to install Mozjpeg in Linux Mint 19.
If you do not know what Mozjpeg is, you will know one more useful software through this article.
What is the Mozjpeg project?
Mozjpeg is a project of Mozilla. According to the homepage:
MozJPEG reduces file sizes of JPEG images while retaining quality and compatibility with the vast majority of the world’s deployed decoders.
You can read more about Mozjpeg’s features at this github link.
Basically for me, I use it to compress the images that I will upload to my blog.
Step-by-step to install Mozjpeg in Linux Mint 19
This section will present you step by step how to install Mozjpeg successfully on Linux Mint 19.
Install dependent packages
This software will need some of the following dependencies to work:
- autoconf
- automake
- libtool
- nasm
- make
Now type the following command to install those dependencies.
danie@linux:~$ sudo apt-get install autoconf automake libtool nasm make -yDownload the source code
You can select their installed versions at this link, because the version may vary over time.
At the time I wrote this article, Mozjpeg has version v3.3.1.
Now type the following command to download and extract the source code.
Recommended Reading: How to install Pycharm community in Linux Mint
danie@linux:~$ cd /tmp
danie@linux:~$ wget https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz
danie@linux:~$ tar -xzf v3.3.1.tar.gzCompile and install the source code
First, move to the unzipped folder of the source code.
danie@linux:~$ cd mozjpeg-3.3.1/Next, use the autoreconf command to create the configure file for the source code.
danie@linux:~$ autoreconf -fivAnd then, you create the build directory to contain the installation files. Move into the build directory.
danie@linux:~$ mkdir build && cd buildRun the configure file to create the Makefile, which will be used to install the final program on your computer.
danie@linux:~$ sh ../configureAnd finally, run make install with sudo permissions so that it installs Mozjpeg into the /opt folder in your computer.
danie@linux:~$ sudo make installRecommended Reading: Install Tomate pomodoro software on Linux

Use Mozjpeg
Now, type the following command to see the executable files of Mozjpeg installed on your computer.
danie@linux:~$ ls /opt/mozjpeg/bin/
cjpeg djpeg jpegtran rdjpgcom tjbench wrjpgcomThere is a problem, if you want to use, for example jpegtran, you will have to type the command like this.
danie@linux:~$ /opt/mozjpeg/bin/jpegtran --helpInstead of typing such a command, we will create a link for easier use, we name it mozjpeg to make it easier to remember.
danie@linux:~$ sudo ln -s /opt/mozjpeg/bin/jpegtran /usr/local/bin/mozjpegNow you just need to type the command like this.
danie@linux:~$ mozjpeg --helpConclusion
So the article has guided you step by step to successfully install the Mozjpeg tool in Linux Mint 19. I believe these installation steps will also work well on both new Ubuntu and Debian versions.
(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).