http://www.perlmonks.org?node_id=267059


in reply to GIF patent

PNG has its pixels expressed in 24 bits while GIF only 8.

Actually, PNG allows up to 36 bits per pixel.

Update: 48 if you include the alpha channel.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: GIF patent
by meredith (Friar) on Jun 20, 2003 at 01:33 UTC
    Point #1: PNG's limitation on image dimensions is 2**31 in both directions. So that makes the image max out at 2**31 * 2**31 (4_611_686_018_427_387_904). Take 8 bits for red, green, and blue color channels: 2**62 * 24 (Yes, it supports 12 bpp and one more channel, I know) Divide by 8 to get bytes: 13_835_058_055_282_163_712 That's 12 petabytes. I'd tell you what size a PNG of that raw image would be, but I can't do it on paper ;) The point is, larger than those dimensions, there is a loss, but I don't see anyone still using PNG by the time we can process that kind of data easily. (chunks are too small)

    Point #2: JPEG also has a limitation on image dimensions, I'll leave it as an exercise to the reader. No more math, ugh.

    Point #3: If I have a raw bitmap as described above, and feed it into a program (say raw2png), then feed it into png2raw, I will get the exact same bitmap. Lossless

    Point #4: If I attempt to do the same with a JPEG converter, my images are different. JPEG estimates images using math. Lossy.

    Point #5: If I am publishing an online comic, I'll use PNG. If I am publishing nature stock photos, I'll use JPEG. That's how it is. I'll do the same if I stick a small picture in a GUI.

    Point #6: Why was my JPEG lossy? It was either me or my encoder because JPEG supports lossless compression -- must've been me.

    Point #7: JPEG (DCT mode (normal mode, that is)) will always be lossier than PNG. It may have been made for natural images, but it's already ruined by being converted to digital representation. There is a great chance that analog images can be approximated using math, in fact, many mathematicians have analyzed this. If there were a way to store analog images on a "computer", then FFT it, then it would be still be lossy to an smaller extent, but PNG would be lossier :)

    Okay, now that the points have been laid out, I will say this once and only once: Use the right tool for the job.



    Another subject of concern is that my fellow monks, merlyn and sauoq, are at each-other's throats. There is a reason this is PerlMonks -- most monks are generally well-tempered and helpful. Try it.   I have reason to believe that neither of you did anything useful for the OP. Maybe one of you needs to be an adult and stop this, or maybe you both need to work it out in private. Whatever it is, get it out of useless threads in SoPW, please.
    On-topic: I too attempted to use Tk::PNG and had issues on Win32... It's unlikely I have the expertise to sort all of the problems out; sorry.

    mhoward - at - hattmoward.org