Showing posts with label Images. Show all posts
Showing posts with label Images. Show all posts

Tuesday, September 4, 2012

How to Losslessly Optimize JPG, PNG, and GIF Images on Linux Using littleutils

Reducing image file sizes without sacrificing visual quality is one of the highest-impact optimizations for production websites. The littleutils package provides a collection of fast, lightweight command-line utilities—including opt-png, opt-jpg, and opt-gif—that losslessly compress images for faster web delivery.

Supported Utilities: opt-png (via pngcrush) • opt-jpg • opt-gif (via gifsicle)

1. Installing Required Prerequisites (CentOS / RHEL)

Install the necessary build tools and image compression libraries:

yum groupinstall "Development Tools" -y
yum install libpng-devel libjpeg-turbo-devel gifsicle -y

Compiling pngcrush:

cd /usr/src
wget https://sourceforge.net/projects/pmt/files/pngcrush/1.8.10/pngcrush-1.8.10.tar.gz
tar -zxf pngcrush-1.8.10.tar.gz
cd pngcrush-1.8.10
make
cp pngcrush /usr/local/bin/

2. Compiling littleutils

Download and build the littleutils suite:

cd /usr/src
wget http://downloads.sourceforge.net/project/littleutils/littleutils-source/1.0.27/littleutils-1.0.27.tar.bz2
tar -jxf littleutils-1.0.27.tar.bz2
cd littleutils-1.0.27
./configure --prefix=/usr/local
make
make install
make install-extra

3. Usage Examples

Optimize individual files or batch-compress entire image directories in place:

# Optimize a single PNG image losslessly
opt-png image.png

# Optimize a single JPEG image
opt-jpg photo.jpg

# Optimize all images in a directory
find /var/www/html/images/ -type f -name "*.png" -exec opt-png {} +
find /var/www/html/images/ -type f -name "*.jpg" -exec opt-jpg {} +

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...