Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Apple apparently ships a PNG encoder that completely flushes the deflate stream every now and then, giving you additional offsets where you can start decompressing without dependencies on previous data. The offsets are then saved as a separate chunk in the PNG. Decoders aware of this can parallelize decoding using these offsets, everyone else can read it as normal.

The proper solution would of course be to use something more modern than deflate, the PNG format even has a metadata field that specifies the used compression algorithm. But anything but deflate wouldn't be backwards compatible, so nobody seems to use that option.



The Apple encoder only splits the PNG in the middle.[0] This was linked from a recent HN post about a hack that exploits this to have PNGs that display differently in some situations on Apple machines.[1]

[0] https://www.hackerfactor.com/blog/index.php?/archives/895-Co...

[1] https://news.ycombinator.com/item?id=29573792




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: