←back to thread

A new PNG spec

(www.programmax.net)
615 points bluedel | 2 comments | | HN request time: 0.406s | source
Show context
poisonborz ◴[] No.44375523[source]
Not backwards compatible. We just add it to that nice cupboard "great advanced image formats we will forget about".

Society doesn't need a new image format. I'd wager to say not any new multimedia format. Big corporate entites do, and have churning them out at a steady pace.

Look at poor webp - a format pushed by the largest industry players - and the abysmal everyday use it gets, and the hate it generates.

replies(10): >>44375537 #>>44375557 #>>44375998 #>>44376442 #>>44376512 #>>44376957 #>>44376999 #>>44377083 #>>44377151 #>>44380128 #
lioeters ◴[] No.44376512[source]
> Not backwards compatible

They say it's technically compatible since older image decoders should recognize the PNG file is using a different compression algorithm than the default.

> Many programs already support the new PNG spec: Chrome, Safari, Firefox, iOS/macOS, Photoshop, DaVinci Resolve, Avid Media Composer...

This is intentionally ignoring the fact that there are countless PNG decoders out in the wild, many using libpng the standard decoder last updated 6 years ago; and they will not be able to read the new PNG v2 files.

They should have used a different file extension, PNG2, to distinguish this incompatible format. Otherwise, users will be confused why their newly saved PNG file cannot be read by certain existing programs.

replies(2): >>44376562 #>>44378083 #
JKCalhoun[dead post] ◴[] No.44376562[source]
[flagged]
colejohnson66 ◴[] No.44377005[source]
Those are indeed the "magic" bytes of PNG. It's a very clever choice meant to ensure the transport layer didn't mess with it.

To start, there's a byte with the upper bit set which ensures an "8-bit clean" transport. If it's stripped, it becomes a harmless tab. Then the literal "PNG" text so you can see it in a text editor. Then a CR-LF pair to check for CR-LF to LF translations. Then, a CTRL-Z to stop display on DOS-like systems. And finally, another LF to check for LF to CR-LF translations.

It's a clever "magic" that basically ensures a binary transport layer. Things that mattered back in 1996.

https://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R...

replies(1): >>44386061 #
1. account42 ◴[] No.44386061[source]
It's clever but I'm not so sure it actually mattered - other formats have done just as well with simpler magic numbers. All it does in the end is that you get something that doesn't identify as a PNG file rather than a PNG file with bad data when a non-binary transport is used - both results are bad and immediately apparent.
replies(1): >>44389421 #
2. colejohnson66 ◴[] No.44389421[source]
Yes and no. It wasn't just about telling you a problem occurred, but failing early and being able to say exactly why. A "something in the chain is running in 7-bit mode" is more helpful than "CRC error in IDAT". Maybe the developers were being a bit too ambitious/hopeful, but an eight byte "magic" over a "simpler" four byte one isn't really worth crying over, even with 1996 download speeds.