3 ms·
PNG is one of my favourite file formats. It also has a chunking system which lets you store extra data, which isn't really covered here. Definitely worth lookin
by jdpage 11y ago
PNG is one of my favourite file formats. It also has a chunking system which lets you store extra data, which isn't really covered here. Definitely worth looking into if you're interested in binary format design.
The other image format that's worth knowing is TIFF, because it's an insanely simple and flexible format to write out if you don't have access to a library. It lets you re-order the image data by tiles or scan lines, and lets you put various tables almost anywhere in the file, which makes it great for outputting large images from a parallel renderer: you can chop it up however is suitable for the algorithm, write out the parts to disk as you get them, and then write out a table at the end describing the order at the end of the file, without having to seek.
- gus_massa 11y agoIn particular PNG may have a chunk that store the gamma information of the file, that is important to correct the differences between the standard configuration of PC and Mac monitors. This value is difficult to find, and some programs ignore it and other use it. I had a few nightmares cases trying to make a webpage look right until I realize that the PNG has a hidden gamma value. More details of a similar case: http://morris-photographics.com/photoshop/articles/png-gamma.html http://morris-photographics.com/photoshop/articles/png-gamma...
- userbinator 11y agoThe gamma chunk can also be used for some interesting tricks: https://news.ycombinator.com/item?id=10192413 https://news.ycombinator.com/item?id=10192413
- TwoBit 11y agoTIFF is a nightmare to read, because there are too many options. It tries to be a format of many other formats.
- maxst 11y agoa.k.a. Thousands of Incompatible File Formats. These days it's basically "what libtiff supports".
- gpvos 11y agoActually it is (or at least used to be) more like "what Photoshop supports". Libtiff implementers often look to what Photoshop does to see how to implement something. But libtiff has a very large influence too. (I don't think Photoshop supports BigTIFF yet.)
- gpvos 11y agoWriting TIFF is trivial. Reading it is a nightmare if you want to account for its myriad options.