Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: How to improve image resolution

by jhourcle (Prior)
on Aug 06, 2005 at 14:24 UTC ( [id://481485]=note: print w/replies, xml ) Need Help??


in reply to Re: How to improve image resolution
in thread How to improve image resolution...Continued

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.

Replies are listed 'Best First'.
Re^3: How to improve image resolution
by BrowserUk (Patriarch) on Aug 06, 2005 at 14:53 UTC

    You don't mention png. It seems to address the problems with both gif (limited palette) and jpg (lossy compression).

    I wonder if I missing something?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
Re^3: How to improve image resolution
by neniro (Priest) on Aug 06, 2005 at 15:08 UTC
    jhourcle++ (great explanation)

    If I want to put graphics onto the web I shrink/convert them to .gif or .png - as long as they're work-in-progress I want them in the best possible quality and un- or lossless-compressed (as .tif).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://481485]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-19 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found