-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Background
Apple have created a public chunk, iDOT
, which is in widespread use on macOS, iPadOS and and iOS, particularly for screenshots. Despite being public, it was never registered.
The chunk has been reverse engineered with further details and an Apple engineer has confirmed that the analysis is correct:
I was involved in adding this to PNGs in ~2011 or so. I don't remember the details but you've got this pretty much right.
The reason was indeed performance: on the first retina iPads, decoding PNGs was a huge portion of the total launch times for some apps, while one of the two cores sat completely idle. My guess is that it's still at least somewhat useful today, even with much much faster single-thread performance, because screen sizes have also grown quite a bit.
Problems
The chunk has some design problems: it uses file offsets to point to other chunks, which are known to be problematic and means that it breaks if, for example, a text comment is inserted between iDOT
and IDAT
; it also breaks if the PNG image data is recompressed, for example by an image optimizer) so we should not add it to the main PNG specification, although the problem of multithreaded decoding that it tries to solve is under active consideration:
However, the chunk is in widespread use and, being ancillary, does not interfere with regular image decoding and viewing software. It is common for people to ask what it is:
- Unanswered question "iDOT PNG chunk" on Apple developer forums
- What is the iDOT chunk on Stack Overflow
Programs like pngcheck report it as an error, because it is an unregistered public chunk.
I confirm that "iDOT" is not a registered PNG chunk. – Glenn Randers-Pehrson Commented Nov 24, 2015
Solution - register it
We have a document listing chunks which are not a part of the main PNG specification:
and this includes chunks which were formally registered, like sTER
Indicator of Stereo Image, chunks which were registered but never actually defined, like fRAc
Fractal image parameters, chunks which were documented elsewhere, like dSIG
Digital signature and even chunks which are deprecated, like gIFt
GIF Plain Text Extension.
The non-registered status of iDOT
has caused actual problems; recently pngcheck had an issue raised
and associated pull request to treat all unknown ancillary chunks as warnings, not errors specifically to silence errors caused by iDOT
.
Therefore, a simple solution is to add iDOT
to the PNG Extensions document.
I suggest adding it to the Chunks Not Described Here section, with a pointer to the reverse-engineered description.
Although I can also see the benefits of treating it as a regular registered chunk (the advantage being robustness if the external document goes away; the drawback being that the registration becomes the official definition).
Checkers like pngcheck (which already treat all the extension chunks as valid) can then simply report the existence of the iDOT
chunk, rather than treating it as an error.
Note: The iDOT
chunk has also been mentioned in passing in connection with another, more problematic Apple chunk, CgBI
: