-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treatment of unknown chunks #221
Comments
Fwiw, the PNG spec also dictates that chunk ordering matters. In some cases, this means that the unknown chunk's position relative to other critical chunks is important. While I doubt this necessitates storing every chunk in the decoder, full support probably requires:
|
Prior art: typedef struct png_unknown_chunk_t
{
png_byte name[5]; /* Textual chunk name with '\0' terminator */
png_byte *data; /* Data, should not be modified on read! */
size_t size;
/* On write 'location' must be set using the flag values listed below.
* Notice that on read it is set by libpng however the values stored have
* more bits set than are listed below. Always treat the value as a
* bitmask. On write set only one bit - setting multiple bits may cause the
* chunk to be written in multiple places.
*/
png_byte location; /* mode of operation at read time */
}
png_unknown_chunk;
// In Rust: fn png_user_chunk_ptr(png_structp, png_unknownn_chunkp) -> int;
typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
png_unknown_chunkp)); Furthermore, the support must be enabled by calling
|
How is this currently handled? Does the library just not work when reading unknown chunks? |
Unknown chunks are currently always skipped over. This is technically not quite right but at least it won't fail to decode images. |
Several png tools would profit from or require processing unknown chunks. We should also check and help that the chunk flag bits are adhered to in all such processing. This requires some plan on how to embed chunk processing in the decoder, likely with a trait/callback API:
The text was updated successfully, but these errors were encountered: