ImageSharp icon indicating copy to clipboard operation
ImageSharp copied to clipboard

PngDecoder: ImageFormatException: Image stream is not valid

Open ChrisVanDijk opened this issue 9 years ago • 4 comments

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 DEBUG and RELEASE mode
  • [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: Error image

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

ChrisVanDijk avatar Feb 13 '17 21:02 ChrisVanDijk

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

JimBobSquarePants avatar Feb 13 '17 22:02 JimBobSquarePants

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: Error image

ChrisVanDijk avatar Feb 13 '17 22:02 ChrisVanDijk

Excellent. I can analyse both now. Thanks! 👍

JimBobSquarePants avatar Feb 13 '17 22:02 JimBobSquarePants

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! 👍

JimBobSquarePants avatar Feb 13 '17 22:02 JimBobSquarePants