We don't bite newbies here... much | |
PerlMonks |
Re^2: How to improve image resolutionby jhourcle (Prior) |
on Aug 06, 2005 at 14:24 UTC ( [id://481485]=note: print w/replies, xml ) | Need Help?? |
You can save a 24 bit image as a GIF without any loss of quality, provided that your 24 bit image only uses 254 colors other than black or white, and the program doing the conversion supports adaptive palettes, rather than using the 'web' palette, or the system palette. The problem with GIF is if there are too many colors, or the colors aren't defined in the color palette, the graphics program must either select the 'closest' color (for which every program handles this differently -- some just use the closest in terms of an RGB color cube, while others have algorythms to deal with a typical human's ability to differentiate color), or it must 'dither' the image, which involves lots of little dots of different color to make it look like the color from a distance, like the impressionist styles of Monet or van Gogh painting. An overly restrictive color palette actually hurts the compression of GIF images, as it tracks horizontal bands of the same color -- so dithering breaks up continuous bands of color. Because of this, GIF does well with computer generated graphics, with solid colors, no gradients, and little or none anti-aliasing. It does not handle photo realistic images, which JPEG is better for. (and yet -- JPEG has the exact opposite problem -- it doesn't handle solid colors well, especially if there are sharp changes between colors) GIF's only loss comes from the palette selection -- the compression is LZW, the same as used in TIFF. So, what's the point of all this? Well, it's that every image format has their own advantages -- TIFF is a great format for interchange between graphics programs, but it's not good for compatability on webpages. You just have to be aware of the advantages/disadvantages of each format, and select what works best in a particular situation. Update: as BrowserUK pointed out, I didn't complain about PNG. There's a few different versions, and varying support for them. There's good support for PNG in web browsers, but you still may have to deal with the occassional older browser depending on your audience. (but it does hold the advantage in that field as it's a w3c recommendation). It also holds the advantage of being designed after the others, so it built on the strengths of each one, and mitigated the problems. The only thing that I'd say gives it a significant disadvantage over any other format is its non-lossy compression -- as such, a JPEG tends to be smaller for photo-realistic images (specifically because it trashed some of the data) I'd say the problems with PNG tend to be more with improperly using it, than the format on its own.
In Section
Seekers of Perl Wisdom
|
|