PngDecoder: ImageFormatException: Image stream is not valid
Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am running the latest version of ImageSharp
- [x] I have verified if the problem exist in both
DEBUGandRELEASEmode - [x] I have searched open and closed issues to ensure it has not already been reported
Description
I have a png file which causes the following error:
ImageSharp.ImageFormatException: Image stream is not valid!
at ImageSharp.Formats.PngDecoderCore.ReadChunkLength(PngChunk chunk)
at ImageSharp.Formats.PngDecoderCore.ReadChunk()
at ImageSharp.Formats.PngDecoderCore.Decode[TColor](Image1 image, Stream stream)
at ImageSharp.Image1.Decode(Stream stream)
at ImageSharp.Image`1.Load(Stream stream)
If I resave the file with another program, it works as expected.
Steps to Reproduce
Try to open/resize the following file:

System Configuration
- ImageSharp version: 1.0.0-alpha2-00052
- Other ImageSharp packages and versions: ImageSharp.Formats.Png: 1.0.0-alpha2-00048
- Environment (Operating system, version and so on): Windows 10 Pro x64
- .NET Framework version: .NET Core 1.1.0, NETStandard 1.6.1
Hi @chrisvandijk thanks for the extra info. I'll look into this asap.
If I resave the file with another program, it works as expected.
Can you clarify exactly what you mean here? What software did you use to load and resave the image?
Cheers
James
Can you clarify exactly what you mean here? What software did you use to load and resave the image?
If I open the broken image in Fireworks and re-save it, ImageSharp opens and resizes the file correct. The following file is saved via Fireworks:

Excellent. I can analyse both now. Thanks! 👍
The once the next png build finishes ImageSharp.Formats.Png.1.0.0-alpha2-00049 you should be able to load that image with no issues. Thanks again! 👍