The libjpeg-turbo is a high-performance implementation of the JPEG image codec that uses SIMD optimizations to improve compression and decompression speed while maintaining compatibility with the standard JPEG format. It provides several command line utilities for JPEG image processing, including jpegtran for lossless transformations, cjpeg for encoding, djpeg for decoding, and other tools for managing JPEG files. This tutorial explains how to install libjpeg-turbo utilities on Ubuntu 26.04.
Install libjpeg-turbo Utilities
Begin by refreshing the package index to ensure the latest package information is available:
sudo apt update
Install the libjpeg-turbo utilities:
sudo apt install -y libjpeg-turbo-progs
Confirm that the utilities have been installed correctly by displaying their version information:
jpegtran -version
cjpeg -version
djpeg -version
Testing libjpeg-turbo Utilities
To test the JPEG optimization features, download a sample image:
curl -sSo test.jpg https://raw.githubusercontent.com/ianare/exif-samples/master/jpg/exif-org/nikon-e950.jpg
Use jpegtran to optimize the JPEG file without changing the image quality:
jpegtran -optimize test.jpg > optimized.jpg
Compare the original and optimized file sizes:
ls -l
-rw-rw-r-- 1 ubuntu ubuntu 151601 Jul 23 04:41 optimized.jpg
-rw-rw-r-- 1 ubuntu ubuntu 164151 Jul 23 04:41 test.jpg
Uninstall libjpeg-turbo Utilities
If decided to remove the installed libjpeg-turbo utilities, run the following command:
sudo apt purge --autoremove -y libjpeg-turbo-progs
Leave a Comment
Cancel reply