-
Notifications
You must be signed in to change notification settings - Fork 0
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
macOS Screenshot application generates invalid PNG files #17
Comments
In the gem just wrapped pngcheck that rigorously checks the image against specification |
As a simple workaround, I propose that the Ruby library hides this iDOT error since it is acceptable for readers. Ideally there is a PngCheck initialization context that I can do: instance = PngCheck.new
instance.verify(IO.read("my.png"))
=> raise "illegal (unless recently approved) unknown, public chunk iDOT"
instance = PngCheck.new(:readonly)
instance.verify(IO.read("my.png"))
=> :ok Ref: w3c/png#45 (comment) |
@ronaldtse
|
The iDOT packet is not a registered chunk, which means it is considered an "unknown" chunk. We do not know if all PNG editors can read the image. But that is irrelevant, because the PNG specification allows unknown chunks (see below). The point is, if a PNG editor cannot read the image with an iDOT or cannot preserve the iDOT, it is in violation of the PNG specification. According to the PNG specification:
And
Upon reading this it is clear an unknown chunk type is at most a "WARNING", not an "ERROR". So we should not raise any Error class when encountering it. Since pngcheck produces a number of warning/error messages, but does not properly categorize them, it is up to us (the consumer library) to categorize them and present them to our users. |
Based on your analisys I will patch pngcheck so that it will return
In case of WARNING we have two options:
Please advise |
Agree. I know this is not ideal but it's what is possible.
The latter please. |
For example, this file is invalid.
However I'm having a hard time believing that the Screenshot app generates an invalid PNG.
@maxirmx any thoughts here?
The text was updated successfully, but these errors were encountered: