question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, Nov 9, 2017

@danludwig This has been resolved in the latest release

1reaction
danpetittcommented, Sep 12, 2017

Sure no problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

PHP increase chunk data size for an image - png
"zTXt: chunk data is too large" means that the file is corrupted. To confirm that you can open it with e.g. GIMP: GIMP:...
Read more >
chunk data is too large - Legacy ImageMagick Discussions ...
Getting this error when trying to resize large tif image. vs 2015 installed Magick.NET 7.5.0.1 as I read that this issue was fixed...
Read more >
PNG Specification: Chunk Specifications
To read the image data, reverse this process. There can be multiple IDAT chunks; if so, they must appear consecutively with no other...
Read more >
270 libpng-1.6.32 rejects valid PNG images with "IDAT
#270 libpng-1.6.32 rejects valid PNG images with "IDAT: chunk data is too large". Milestone: libpng_code. Status: closed-fixed.
Read more >
PNG file chunk inspector
A PNG file can contain multiple IDAT chunks to hold the compressed image data. This is semantically equivalent to concatenating the data bytes ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found