Things about Web Images I Just Learned
gabrielweinberg.com
gabrielweinberg.com
* IE will not display JPEG images that have some types of embedded meta-data. This includes previews, which a lot of editing programs do include.
* IE and Safari both freak out on JPEG images that are in the CMYK colorspace. Conversion to RGB and removal of color profiles will fix this problem.
These are generally not big a deal when you're creating images yourself, but whenever you're accepting user-generated images these points could really bite you. I know they caused me a lot of pain!
Hope this saves someone at some point!
I've had trouble with IE and FireFox and CMYK, Safari works fine. At least on Macs, I haven't tried Safari for Windows.
My policy now is that any user-supplied image is stripped of all meta-data and converted to the RGB colorspace. Since I've started doing that I haven't had a single issue!
Apart from the fact that web browsers are notorious for over eagerly caching images no matter what http headers are specified, you have no control over external http proxies and their versions of your images.
So never allow someone to update an image, only allow delete and create actions, using a fresh new url each time.
optipng: png files are often not optimally small, even for what can be done by an automated process. Run optipng on the png's on your site, you'll be suprised.
example (compare before and after idat sizes): find /usr/share/gnome -iname .png -print0|xargs -0 optipng -o7 -simulate
advancecomp: a zlib implementation that tries harder to compress, but with output that is still totally compatible.
use like: advpng -z -4 $file
advpng should only be used after* optipng, since optipng won't want to save the file if it is larger, even if the idat is smaller. since optipng can only use the regular zlib, the smallest files come from optimizing the idat, then optimizing the compression.
Just going through a regular debian desktop install, you will see png files that shrink over by over 90%. This is, of course, a lossless operation.
However, what would be really cool is something which would dither down, based on some of the research that is going on in that field. I saw a java applet once that could dither almost anything to 256 colors with barely any noticeable degradation. For something like the iphone, or any other memory limited/bandwidth limited device this would be awesome.
As for PNG files, I'd rather have the transparency and ability to tinker with different backgrounds than have to re-export a set of icons every time.
The idea is that you do all your invasive stuff (like reduce colors etc.) in Save for Web in Photoshop (or similar) and then let one of the two programs do its job, which will visually not alter the image.
If you don't mind me asking (out of curiosity), if you run smush.it on one of your optimized pages, do you get any reduction?