Hi,
I have found this tool that optimizes images for the web. What is surprising for me is that it only optimizes the uploaded image if it is possible, I mean, if it considers that the image is already optimized for the web it says "No savings".
My question: before running something like "convert -quality 80", is there any way (using imagemagick or any other tool in linux) to ckeck if an image is already optimized for the web? In that case I would not run "convert -quality 80".
Javi
Check if an image is already optimized for the web
-
- Posts: 7
- Joined: 2013-05-31T05:10:43-07:00
- Authentication code: 6789
Re: Check if an image is already optimized for the web
You would need to decide what you limitations want e.g. file size, image size etc. and Imagemagick could get the information from the image and compare them to the limits you set.
-
- Posts: 7
- Joined: 2013-05-31T05:10:43-07:00
- Authentication code: 6789
Re: Check if an image is already optimized for the web
Thanks, but I don't have to give the data you mention (file size, image size..) to the tool I mentioned. The tool I'm talking about keeps the image size. How to know those limitations you are talking about? That tool puts the limitations by itself.
Re: Check if an image is already optimized for the web
From you post I assumed you were writing your own code and you would then put limits into variables in your code which the code would check against.Thanks, but I don't have to give the data you mention (file size, image size..) to the tool I mentioned.
If the image dimensions were larger than your limits it would resize the image and if not it would leave it alone.
That is how that code would have been written - somebody would have decided what the limits were.
If you were just resizing you could use the built in resize options. Check the geometry link in the resize section to see what they are.
Last edited by Bonzo on 2013-07-08T10:35:52-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Check if an image is already optimized for the web
What do you mean by optimize for the web? That usually means you are writing a JPG output and want the quality and compression set to some minimum.
Re: Check if an image is already optimized for the web
From the descriptions of the tool at their web site and other sites, it appears to be roughly equivalent to "convert -strip" for JPEGs. For PNGs it also applies pngcrush or similar. I don't see the source for it so can't tell exactly what it does.
-
- Posts: 7
- Joined: 2013-05-31T05:10:43-07:00
- Authentication code: 6789
Re: Check if an image is already optimized for the web
Thanks for your answers, I have found here a list of the tools that website uses:
http://developer.yahoo.com/yslow/smushi ... _crushtool
http://developer.yahoo.com/performance/ ... opt_images
I don't understand exactly the meaning of "..and try progressive JPEGs.".
http://developer.yahoo.com/yslow/smushi ... _crushtool
http://developer.yahoo.com/performance/ ... opt_images
I don't understand exactly the meaning of "..and try progressive JPEGs.".
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Check if an image is already optimized for the web
To reduce the size of a jpeg without modifying the image data: First, toss out the non-image data (metadata) in the file. The thumbnail, camera settings, comment, etc.
Second, redo the lossless compression step. Baseline (Huffman) encoding can be optimized, but often isn't because it is more processor intensive. Especially historically or in cameras. Progressive encoding splits the image into multiple passes of detail. There are many different splits possible, and each may increase or decrease file size. This advanced feature is more widely supported than it used to be. Arithmetic coding can reduce a jpeg further, but is not widely supported (old patents). Further reduction can be achieved by redoing the lossy compression steps.
"progressing JPEGs" - Are you old enough to remember dial-up? Images were new to the internet and sooo slooow! Maybe they will make a comeback with the high-resolution screens and low bandwidth of mobile devices?
Baseline loading looks like:
Progressive loading looks like:
These images are from this article, which mentions your tool.
Second, redo the lossless compression step. Baseline (Huffman) encoding can be optimized, but often isn't because it is more processor intensive. Especially historically or in cameras. Progressive encoding splits the image into multiple passes of detail. There are many different splits possible, and each may increase or decrease file size. This advanced feature is more widely supported than it used to be. Arithmetic coding can reduce a jpeg further, but is not widely supported (old patents). Further reduction can be achieved by redoing the lossy compression steps.
"progressing JPEGs" - Are you old enough to remember dial-up? Images were new to the internet and sooo slooow! Maybe they will make a comeback with the high-resolution screens and low bandwidth of mobile devices?
Baseline loading looks like:
Progressive loading looks like:
These images are from this article, which mentions your tool.