jpegtran is a command-line utility of the libjpeg package. It allows manipulating JPEG files, but its most useful function is optimization. Jpegtran compresses lossless images and deletes metadata
Install jpegtran
For Linux, this utility is usually in packages:
apt-get install libjpeg-progs
The source code for Linux, as well as the version for Windows can be downloaded here. Description of the installation for Mac is here.
Using
For the basic optimization we call the command:
jpegtran -copy none -optimize -outfile min.image.jpg image.jpg
- -copy none removes all metadata from the source file
- -optimize optimizes the image
Progressive
To change the format on progressive, use the following command:
jpegtran -progressive -copy none -optimize -outfile min.pro.image.jpg image.jpg
Quality change
You can also specify the degree of compression to visually find the best value:
jpegtran -quality 80 -copy none -optimize -outfile min.pro.image.jpg image.jpg
Try different values from 5 to 95.
How to recursively use JpegTran (from the command line) to optimize all files in subdirectories?
find /var/image/path -name "*.jpg" -type f -exec jpegtran -copy none -optimize -outfile {} {} \;
это сайт проекта http://jpegclub.org/jpegtran/
а это утиита от гугл проверяющие разные парамтры статических файлов на сервере
https://developers.google.com/speed/pagespeed/insights/?hl=ru
2. pngcrush – еще одно средство оптимизации для PNG. Использует алгоритм сжатия без потерь:
pngcrush -reduce -brute in.png out.png
Comments
To leave a comment
Running server side scripts using PHP as an example (LAMP)
Terms: Running server side scripts using PHP as an example (LAMP)