---
# Install MozJpeg encoder with Ubuntu 20.4
**URL:** https://modul-r.codekraft.it/install-mozjpeg-encoder-with-ubuntu-20-4/
Date: 2022-04-09
Author: Erik
Post Type: post
Summary: MOZjpeg is a very interesting fork of turbojpeg, it saves on average 10-15% compared to a normal jpeg without losing backward compatibility. Its disadvantage is the time it takes to be encoded (x2.5) and that it lacks the alpha channel that new-gen formats like avif and webp have. A good explanation about the differences of […]
Categories: Blog
---
MOZjpeg is a very interesting fork of turbojpeg, it saves on average 10-15% compared to a normal jpeg without losing backward compatibility. Its disadvantage is the time it takes to be encoded (x2.5) and that it lacks the alpha channel that new-gen formats like avif and webp have.
A good explanation about the differences of jpeg-turbo with MOZjpeg and some testing comparations could be found here [https://libjpeg-turbo.org/About/Mozjpeg](https://libjpeg-turbo.org/About/Mozjpeg).
Below the steps to compile the encoder/decoder alongside Ubuntu 20.04, if you have any doubts or comments leave them here below, i love to hear your through about.
**Install Compiler Tools**
```
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install cmake autoconf automake libtool nasm make pkg-config
```
**download and install MOZjpeg from source**
```
wget https://github.com/mozilla/mozjpeg/archive/refs/tags/v4.0.3.tar.gz -O mozjpeg-master.tar.gz
tar xvzf mozjpeg-master.tar.gz
cd mozjpeg-master/
mkdir build && cd build
sudo cmake -G"Unix Makefiles" -DPNG_SUPPORTED=ON ../
sudo make install
sudo make deb
sudo dpkg -i mozjpeg_4.0.3_amd64.deb
sudo ln -s /opt/mozjpeg/bin/cjpeg /usr/bin/mozjpeg
sudo ln -s /opt/mozjpeg/bin/jpegtran /usr/bin/mozjpegtran
```
give a try with `mozjpeg -h`:
mozjpeg -h
[](https://modul-r.codekraft.it/wp-content/uploads/2022/04/kodim04.png)PNG 625kb
[](https://modul-r.codekraft.it/wp-content/uploads/2022/04/kodim04.jpg)turbo-jpg 85kb - quality 85
[](https://modul-r.codekraft.it/wp-content/uploads/2022/04/kodim04.moz_.jpg)MOZjpeg 82kb - quality 75
the standard jpg has been converterted with:
`convert -quality 85 kodim04.png kodim04.jpg`
the MOZjpg has been converterted with:
`cjpeg -quality 77 -nojfif -tune-ssim kodim04.png > kodim04.moz.jpg`
---
## Categories
- Blog
---
## Navigation
- [Modul*R](https://modul-r.codekraft.it/)
---
## Footer Links
- [WordPress](https://wordpress.org/)