Jpegtran - JPEG image optimization, installation and bulk operations

Lecture



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

  Jpegtran - JPEG image optimization, installation and bulk operations

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 

# save the optimized copy in min.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 

# saves the result to the min.pro.image.jpg file

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
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Running server side scripts using PHP as an example (LAMP)

Terms: Running server side scripts using PHP as an example (LAMP)