Live data from Hacker News

File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

skientia.co

11–20 of 25 posts

Re: File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

#12

Kind of wish this site went to more effort to explain some of the details. I'm a graphics programmer so I can guess why PNG is bad at alpha, but they've done nothing to convince me that EXR gets it right other than show one or two comparison screenshots.

As someone who have implemented both EXR and PNG I can explain!

Alpha can be used in multiple ways, most commonly as a blend:

result = background * (1.0 - alpha) + forground * alpha;

If the alpha and forground is stored in the same image, you can notice that we can pre compute forground * alpha. This is known as pre-multiplication, and is a very common techniqe. An added benefit of this is that we get more dynamic range, and can add to the composit, without removing the background.

This is possible in both PNG and EXR. HOWEVER, if you dont intend to pre-multiply, then the forground is not used if alpha is zero. The people who implemented LibPNG, the most common implementation of PNG, figured that they could make an optimization by throwing away the forground and just store black if alpha is zero. This improves file sizes since run length encoding is used.

This means that while, PNG the format, can store forground data with zero alpha, any application using LibPNG or other implementation with the same optimization may throw away the data. Photohop is a prime example of this. This makes PNG very unreliable when working with alpha.

Re: File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

#13
post #5

> Screen-grabs can be taken in JPG JPEG is unacceptable for screenshots of text, unless you can disable chroma subsampling, which isn't always an exposed option. As a quick test, I took a screenshot of this comment, and saved it as both a PNG and 100% quality 444 JPEG, exported from GIMP. The JPEG is 81477 bytes, and the PNG is 44212.

Note that sometimes text is not rendered as 1D monochromatic but with some kind of slight pixel-level chromatic abberation. In this case I'm not sure PNG will do so well

Re: File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

#14
post #13
post #5

> Screen-grabs can be taken in JPG JPEG is unacceptable for screenshots of text, unless you can disable chroma subsampling, which isn't always an exposed option. As a quick test, I took a screenshot of this comment, and saved it as both a PNG and 100% quality 444 JPEG, exported from GIMP. The JPEG is 81477 bytes, and the PNG is 44212.

Note that sometimes text is not rendered as 1D monochromatic but with some kind of slight pixel-level chromatic abberation. In this case I'm not sure PNG will do so well

In my test the screenshot had no subpixel AA, but if it did why would that be an issue? (beyond it looking ugly when upscaled)

Re: File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

#16
post #7

This page makes no sense: e.g. proposing (uncompressed) jpeg over png for screenshots without any explanation why (note that even uncompressed jpeg doesn't necessarily store the exact original rgb color values but is likely ok for 8-bit rgb). Calls png "forbidden" but lists a bunch of other formats (without listing an actually good one like jpeg xl) as a valid replacement without saying what those (like webp which in…

PNG can display HDR, but the lack of floating-point support does put it at a disadvantage as an intermediate format (there's a demo about half way down the page comparing 16-bit PNG against fp16 EXR, during exposure adjustment)

Re: File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

#17
post #14
post #13

Earlier quoted context omitted.

Note that sometimes text is not rendered as 1D monochromatic but with some kind of slight pixel-level chromatic abberation. In this case I'm not sure PNG will do so well

In my test the screenshot had no subpixel AA, but if it did why would that be an issue? (beyond it looking ugly when upscaled)

It would make the compression take a (tiny) hit. In your test case being dominated by a solid color patch (which describes many screen shots), it would make no practical difference.

Re: File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

#19
post #3

Sorry, but this looks like opinionated nonsense. There's an underlined and bolded "PNG is a forbidden file format" that is in fact not a link, without explaining how and why it is forbidden.

Something vaguely Timecube.com[1] about the presentation style.

1: https://web.archive.org/web/20160112000701/http://www.timecu...

Re: File Formats Debunk – Why you should stop rendering to PNG (and use EXR instead)

#20
post #5

> Screen-grabs can be taken in JPG JPEG is unacceptable for screenshots of text, unless you can disable chroma subsampling, which isn't always an exposed option. As a quick test, I took a screenshot of this comment, and saved it as both a PNG and 100% quality 444 JPEG, exported from GIMP. The JPEG is 81477 bytes, and the PNG is 44212.

I was surprised and confused about this, specially because I take certain care on the screenshots I paste on technical docs everyday, using PNG and a quantizer to reduce color depth.

But on second read I think we're making a mistake because we work on a different domain. I think the article exclusively refers to images produced I'm the workflow of video/CGI/3D rendering and generation for the motion films/multimedia industry. And there it can probably make sense to use a format like that, same as when I use a DNG or similar for storage of my photos.

I think when he said "screen-grab" he wasn't referring to an screenshot of a computer app or desktop, but to a frame of a video or something similar.

Post reply on HN