-
-
Notifications
You must be signed in to change notification settings - Fork 850
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
Image.Load() throws InvalidImageContentException: CRC Error. PNG IDAT chunk is corrupt! #2570
Comments
Libpng also "throws an exceptions":
|
Can they be opened by other imaging libraries? Chrome looks to have turned of the safety checks. (There’s a compiler option in libpng) |
MagicScalar uses libpng and can handle the last image that i posted MagicScalar uses vcpkg precompiled version of libpng. What is the compiler option called can't seam to find it here? |
Ah not a compiler option it seems. Look for |
So this explains why it works in MagicScalar then. Would it be possible to consider this for ImageSharp? |
After further investigation into MagicScaler, it turns out that using default settings on windows will result in native WIC codecs being used. This png codec is forgiving. Any input? |
This is precisely the kind of thing I designed ISpecializedDecoderOptions for. There's no reason we cannot define rules for handling Crc and Adler validation on decode. Would you be interested in creating a PR? |
Tried it a bit but got stuck by the fact that IDAT and IEND is considered critical chunks and found no way of ignoring that fact if the file is truncated, IDAT is cut off and IEND is missing. Maybe you have some pointers for me here |
Sorry for the slow reply @svenclaesson I've been off the boil for the last few weeks with sickness. If you actually open a PR I can commit directly to your fork to help finish it off. |
@JimBobSquarePants What is the easiest way to make use of the new options? Ideally I would like to be able to pass something through via Would it be reasonable to add overloads that take |
Ideally, we'd add a general equivalent to |
Just so I understand, you would like to add a new property to Maybe the new one could be added and mapped to the specialized enum to save a breaking change? If I get time I could make an attempt at that. |
Prerequisites
DEBUG
andRELEASE
modeImageSharp version
3.0.2
Other ImageSharp packages and versions
None
Environment (Operating system, version and so on)
Windows 11 Version 22H2
.NET Framework version
.net 7
Description
I have two png images that opens fine with System.Drawing.Common, but that fails to open with ImageSharp, and instead throw an InvalidImageContentException: CRC Error. PNG IDAT chunk is corrupt! Both files can be viewed in windows.
Steps to Reproduce
Just point to the filePath with Image.Open(filePath) and it should throw the exception when running the code.
Images
The text was updated successfully, but these errors were encountered: