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 reply to Re^2: How to improve image resolution by jhourcle
in thread How to improve image resolution...Continued by chakkaln

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.