Difference between revisions of "Batch jpeg Image Optimization"
(Created page with "==How to compress a jpg image on Centos== The other day I was running a webpagetest on a clients site and the results were telling me to Compress Images Now there was close ...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 15: | Line 15: | ||
Sample output | Sample output | ||
− | image.jpg 710x275 24bit | + | image.jpg 710x275 24bit N JFIF [OK] 143161 --> 136256 bytes (4.82%), optimized. |
===Optimize all JPEG images=== | ===Optimize all JPEG images=== | ||
Line 34: | Line 34: | ||
Here are our results - http://www.webpagetest.org/result/140311_HN_10Z0/ | Here are our results - http://www.webpagetest.org/result/140311_HN_10Z0/ | ||
+ | |||
+ | [[Category:Centos]] |
Latest revision as of 14:52, 14 March 2014
Contents
How to compress a jpg image on Centos
The other day I was running a webpagetest on a clients site and the results were telling me to Compress Images
Now there was close to 200 images that needed to be compressed and optimized. That is when I found jpegoptim
You can learn more about jpegoptim, by reading the man page.
Optimize a Single Image
If you are looking to optimize a single image, you would just type
jpegoptim image.jpg
Sample output
image.jpg 710x275 24bit N JFIF [OK] 143161 --> 136256 bytes (4.82%), optimized.
Optimize all JPEG images
You can use the find command to locate all *.jpg images under your current directory by using the following
for x in $(find $PWD -iname "*.jpg"); do jpegoptim $x; done
By default it will optimize all images in their current locations.
Optimize all JPEG images and convert to Progressive
You will also get a boost in load speeds by converting all images to use progressive, meaning that the entire images does not need to load before going to next request.
for x in $(find $PWD -iname "*.jpg"); do jpegoptim --all-progressive $x; done
Now rerun your webpagetest and see the differences
Here are our results - http://www.webpagetest.org/result/140311_HN_10Z0/