Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

•Re: Re: •Re: GIF patent

by merlyn (Sage)
on Jun 19, 2003 at 03:13 UTC ( #267064=note: print w/replies, xml ) Need Help??


in reply to Re: •Re: GIF patent
in thread GIF patent

PNG doesn't make that trade-off.
No, but PNG makes a different tradeoff... a maximum width-by-height resolution for a given number of output bits.

They're both lossy, just in different directions. Information theory says so. You take the entire rich original experience, and put it into 100K. PNG and JPEG just do it differently. PNG sacrifices width-and-height, while JPEG sacrifices some of the subtler items of a natural image.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re: •Re: Re: •Re: GIF patent
by sauoq (Abbot) on Jun 19, 2003 at 03:38 UTC
    They're both lossy, just in different directions.

    Now I'm beginning to wonder if you really haven't gotten yourself confused.

    for a given number of output bits.

    Forget the output bits. It's the input bits that matter. PNG doesn't truncate¹ the input data. If you want to do that in order to achieve the same output size, that's your business, not your file format's.

    There just aren't two ways about it. PNG isn't lossy as long as you define the term "lossy" in a manner everyone else who talks about compression will understand. Using Information Theory as an excuse to suggest we hold output size constant and then redefine "lossy" to mean "lower compression ratio" doesn't help understanding or foster meaningful communication. Nor is it cool.

    1. I'm using the term "truncate" loosely, of course. I mean to say that conversion to PNG doesn't delete pixel data from the source image.

    -sauoq
    "My two cents aren't worth a dime.";
    
      PNG doesn't truncate¹ the input data.
      Right, because it doesn't need to, since that had to have been done in the first place when you picked a width-and-height.

      Think of it this way. From the original image, for a given output file size, there is an upper bound on the number of pixels times the absolute accuracy of each pixel times the overall accuracy of the image. Information theory tells us that. PNG choses to hold the overall accuracy and absolute accuracy constant, thus bounding the number of pixels. JPEG choses to hold only the overall accuracy of the picture constant, thus allowing the number of pixels to vary inversely with the individual accuracy.

      Certainly, if individual accuracy is important, you can't use JPEG. I'm not arguing that. I'm just saying that at some point, you had to go from "real world continuous values" into "discrete values stored in a file". That's lossy. PNG just lets you pick certain things to hold sacred in that process, and JPEG lets you pick certain other things to hold sacred. I'm happy we have both.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        Right, because it doesn't need to, since that had to have been done in the first place when you picked a width-and-height.

        The point you are arguing is completely void of semantic content.

        File formats and compression algorithms have nothing to do with the inability to perfectly reproduce a visual scene. That doesn't matter because you couldn't get two people to agree on what a perfect reproduction was anyway. It only matters that you have the ability to capture X bits of information. After you capture those X bits of raw information, you are faced with the problem of storing them and must choose a file format.

        If you pick JPEG, you can store that information in less space, but you'll never be able to reproduce your original X bits of information. Hence, we call it "lossy."

        If you pick PNG, you can store that information in less space though probably not as little space as you could if you had chosen JPEG. On the other hand, you will be able to reproduce your original X bits of information. Hence, we call it "lossless."

        Let's hit the salient points again.

        • You can only capture X bits of information.
        • If you choose JPEG to store those X bits, you won't be able to get them back again.
        • If you choose PNG to store those X bits, you will be able to get them back again.

        Hence, we call JPEG "lossy" and PNG "lossless". The accepted terminology is really quite simple.

        Yes, collecting real world data is inherently a "lossy" process. No, that's not relevant to discussing the differences between PNG and JPEG which are applied after the data is already collected.

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

        Merlyn says: I wonder if the picture people are ever going to stop arguing...the one s that don't understand that all file formats are lossy

        If my camera captures an image and saves it in tiff format. NO INFORMATION IS LOST. Non-lossy file format.

        If I then choose to convert this tiff into a .png, the image will be compressed, the output file size will be reduced, but STILL NO INFORMATIO WILL BE LOST. A non-lossy, compressed file format.

        If I choose to convert this program to a .jpg, the output file size will smaller than the tiff, and depending upon the options select during conversion, it may also be smaller than the .png. BUT THIS OUTPUT FILE SAVING WILL HAVE COME AT THE COST OF LOST INFORMATION. DETAIL WILL HAVE BEEN DISCARDED FROM THE ORIGINAL IMAGE. This is a lossy format.

        All the images will remain the same size (width x height) as the original (unless I choose to crop the image, which has nothing to do with the output file format).

        Your statements in this thread that elude to the idea that .png is a lossy format are simply false, misleading and wrong.

Re: •Re: Re: •Re: GIF patent
by Anonymous Monk on Jun 20, 2003 at 18:21 UTC
    You are using a different definition of lossy from everyone else. Lossy means that information is lost in the compression process; the output is different from the input. PNG is not lossy; the exact image is reconstructed.

    You are comparing how much original image can fit into a fixed size of compressed image. This is a backwards way to look at things. I guess it makes some sense if you are trading off compression quality, image size, and number of images on a fixed size memory card. Most people have fixed size images that need to compress to the minimum size without too much loss of quality.

    The compression depends heavily on what the original image looks like. You can compress an enormous, single color image much better with PNG. JPEG would result in smaller input images for the fixed output size. For photos, the reverse is true. But this only holds when the quality reduction is acceptable. For some applications, the output image must be 100% the same as the input. Only lossless compression is acceptable in that case.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-09-24 04:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (191 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!