---
# Install MozJpeg encoder with Ubuntu 20.4

**URL:** https://modul-r.codekraft.it/2022/04/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`:

![](https://modul-r.codekraft.it/wp-content/uploads/2022/04/image.png)mozjpeg -h

[![](https://modul-r.codekraft.it/wp-content/uploads/2022/04/kodim04.png)](https://modul-r.codekraft.it/wp-content/uploads/2022/04/kodim04.png)PNG 625kb

[![jpg](https://modul-r.codekraft.it/wp-content/uploads/2022/04/kodim04.jpg)](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)](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

- [About WordPress](https://modul-r.codekraft.it/wp-admin/about.php)
- [Get Involved](https://modul-r.codekraft.it/wp-admin/contribute.php)
- [WordPress.org](https://wordpress.org/)
- [Documentation](https://wordpress.org/documentation/)
- [Learn WordPress](https://learn.wordpress.org/)
- [Support](https://wordpress.org/support/forums/)
- [Feedback](https://wordpress.org/support/forum/requests-and-feedback)
- [Codekraft Modul R](https://modul-r.codekraft.it/wp-admin/)
- [Plugins](https://modul-r.codekraft.it/wp-admin/plugins.php)
- [Themes](https://modul-r.codekraft.it/wp-admin/themes.php)
- [Widgets](https://modul-r.codekraft.it/wp-admin/widgets.php)
- [Menus](https://modul-r.codekraft.it/wp-admin/nav-menus.php)
- [Background](https://modul-r.codekraft.it/wp-admin/themes.php?page=custom-background)
- [Header](https://modul-r.codekraft.it/wp-admin/themes.php?page=custom-header)
- [Live](https://modul-r.codekraft.it/wp-admin/admin.php?page=wc-settings&tab=site-visibility)
- [Customize](https://modul-r.codekraft.it/wp-admin/customize.php?url=https%3A%2F%2Fmodul-r.codekraft.it%2Fproduct%2Flogo-collection%2F)
- [1414 updates available](https://modul-r.codekraft.it/wp-admin/update-core.php)
- [2,1662,166 Comments in moderation](https://modul-r.codekraft.it/wp-admin/edit-comments.php)
- [New](https://modul-r.codekraft.it/wp-admin/post-new.php)
- [Media](https://modul-r.codekraft.it/wp-admin/media-new.php)
- [Page](https://modul-r.codekraft.it/wp-admin/post-new.php?post_type=page)
- [Product](https://modul-r.codekraft.it/wp-admin/post-new.php?post_type=product)
- [Order](https://modul-r.codekraft.it/wp-admin/post-new.php?post_type=shop_order)
- [User](https://modul-r.codekraft.it/wp-admin/user-new.php)
- [Edit product](https://modul-r.codekraft.it/wp-admin/post.php?post=255&action=edit)
- [SEONo index](https://modul-r.codekraft.it/wp-admin/admin.php?page=wpseo_dashboard)
- [Front-end SEO inspectorPremium](https://yoa.st/admin-bar-frontend-inspector?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Semrush](https://yoa.st/admin-bar-semrush?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Wincher](https://yoa.st/admin-bar-wincher?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Google trends](https://yoa.st/admin-bar-gtrends?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Learn more SEO](https://yoa.st/admin-bar-learn-more-seo?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Improve your blog post](https://yoa.st/admin-bar-improve-blog-post?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Write better content](https://yoa.st/admin-bar-write-better?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Help](https://modul-r.codekraft.it/wp-admin/admin.php?page=wpseo_page_support)
- [Settings](https://modul-r.codekraft.it/wp-admin/admin.php?page=wpseo_page_settings)
- [Tools](https://modul-r.codekraft.it/wp-admin/admin.php?page=wpseo_tools)
- [Plans](https://modul-r.codekraft.it/wp-admin/admin.php?page=wpseo_licenses)
- [Upgrade](https://yoa.st/admin-bar-get-premium-woocommerce?php_version=7.4&platform=wordpress&platform_version=6.8.3&software=free&software_version=25.9&days_active=1650&user_language=en_US)
- [Autoptimize](https://modul-r.codekraft.it/wp-admin/options-general.php?page=autoptimize)
- [Performance](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_dashboard&_wpnonce=a6493b7534)
- [Purge All Caches](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_dashboard&w3tc_flush_all&_wpnonce=a6493b7534)
- [Purge Current Page](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_dashboard&w3tc_flush_post&post_id=255&force=true&_wpnonce=a6493b7534)
- [Page Cache](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_dashboard&w3tc_flush_pgcache&_wpnonce=a6493b7534)
- [Database](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_dashboard&w3tc_flush_dbcache&_wpnonce=a6493b7534)
- [Object Cache](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_dashboard&w3tc_flush_objectcache&_wpnonce=a6493b7534)
- [Feature Showcase](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_feature_showcase&_wpnonce=a6493b7534)
- [General Settings](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_general&_wpnonce=a6493b7534)
- [Manage Extensions](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_extensions&_wpnonce=a6493b7534)
- [FAQ](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_faq&_wpnonce=a6493b7534)
- [Support](https://modul-r.codekraft.it/wp-admin/admin.php?page=w3tc_support&_wpnonce=a6493b7534)
- [Notifications](https://wordpress.com/reader/notifications)
- [Howdy, Erik](https://modul-r.codekraft.it/wp-admin/profile.php)
- [Log Out](https://modul-r.codekraft.it/wp-login.php?action=logout&_wpnonce=bb28826117)
- [Home](https://modul-r.codekraft.it/)
- [Theme Setup](https://modul-r.codekraft.it/2019/06/theme-setup/)
- [Environment Setup](https://modul-r.codekraft.it/2019/06/environment-setup/)
- [Functions and Components](https://modul-r.codekraft.it/2019/06/custom-theme-functions/)
- [Classic](https://modul-r.codekraft.it/category/classic/)
- [Shop](https://modul-r.codekraft.it/shop/)
- [Tag /Archive format](https://modul-r.codekraft.it/tag/post-formats/)
- [Modul R](https://wordpress.org/themes/modul-r/)
- [Modul R (git)](https://github.com/erikyo/Modul-R)
- [Modul R Child (git)](https://github.com/erikyo/Modul-R-child)
- [CF7 Antispam](https://wordpress.org/plugins/cf7-antispam/)
- [OH-MY-SVG](https://modul-r.codekraft.it/oh-my-svg/)
- [Model-Viewer WordPress block](https://modul-r.codekraft.it/model-viewer-wordpress-block/)
- [Remove Capslock](https://wordpress.org/plugins/remove-capslock)
- [Blog](https://modul-r.codekraft.it/category/random-access-memories/)
- [Codekraft](https://github.com/codekraft-studio)
- [About Me](https://modul-r.codekraft.it/erik-golinelli/)
- [Contact](https://modul-r.codekraft.it/contacts/)
- [Credits](https://modul-r.codekraft.it/credits/)

---

## Footer Links

- [Theme Setup](https://modul-r.codekraft.it/2019/06/theme-setup/)
- [Functions and Components](https://modul-r.codekraft.it/2019/06/custom-theme-functions/)
- [Environment Setup](https://modul-r.codekraft.it/2019/06/environment-setup/)
- [Download](https://wordpress.org/themes/modul-r/)
- [Contact form 7](https://modul-r.codekraft.it/category/contact-form-7/)
- [Quick Start](https://modul-r.codekraft.it/category/quick-start/)
- [Classic](https://modul-r.codekraft.it/category/classic/)
- [Post Formats](https://modul-r.codekraft.it/category/post-formats/)
- [Block](https://modul-r.codekraft.it/category/block/)
- [Clothing](https://modul-r.codekraft.it/product-category/clothing/)
- [Privacy Policy](https://modul-r.codekraft.it/privacy-policy/)
- [Proudly powered by WordPress & made in Bologna with ♥ by Codekraft](https://codekraft.it/)