Skip to content

Image is failing to read because IDAT: chunk data is too large #105

@danpetitt

Description

@danpetitt
  • I have written a descriptive issue title
  • I have verified that I am using the latest version of ImageMagick
  • I have searched open and closed issues to ensure it has not already been reported

Description

I try and read the image below and i get an "because IDAT: chunk data is too large" error message:

testimage

Earlier version (v7.0.6.102 specifically) of ImageMagick worked fine, I upgraded to v7.07 and now it doesn't.

The image opens in all image editors fine.

If I open the image in paint.net and save it back out in same format and using Auto-Depth settings, the size reduces from 65kb to 4kb and ImageMagick then has no problems reading it.

Steps to Reproduce

var readSettings = new MagickReadSettings();
readSettings.Format = MagickFormat.Png;

using( var downloadStream = new FileStream( "TestImage.png", FileMode.Open ) )
using( var resizedImageStream = new MemoryStream() )
using( var image = new MagickImage( downloadStream, readSettings ) )  // exception thrown here
{
    image.Strip();                // Strip out all profile info...
    image.Quality = 100;

    image.Write( resizedImageStream, readSettings.Format );
    resizedImageStream.Position = 0;

    // we do something with the memory stream....
}

Stack trace:

Source: Magick.NET-Q16-x64
IDAT: chunk data is too large `' @ error/png.c/MagickPNGErrorHandler/1711
   at ImageMagick.NativeInstance.CheckException(IntPtr exception, IntPtr result)
   at ImageMagick.MagickImage.NativeMagickImage.ReadStream(MagickSettings settings, ReadWriteStreamDelegate reader, SeekStreamDelegate seeker, TellStreamDelegate teller)
   at ImageMagick.MagickImage.Read(Stream stream, MagickReadSettings readSettings, Boolean ping)
   at ImageMagick.MagickImage..ctor(Stream stream, MagickReadSettings readSettings)

System Configuration

Windows 10 Visual Studio 2017, but also on Windows Server multiple versions

  • ImageMagick version: Magick.NET-Q16-x64 v7.07
  • Environment (Operating system, version and so on): Windows (any)
  • Additional information: none not already mentioned above

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions