This project has moved and is read-only. For the latest updates, please go here.

Invalid IHDR data

Oct 21, 2015 at 8:22 AM
Hello I have the next error message when trying to concat verticaly 28 files with the next resolution 524x58350. So total resolution will be 524x1633800.

"Invalid IHDR data C:\inetpub\ICRload\TilingModule\Temp\dfd2cc44-e641-46a9-881c-9b55ae3c7ce6_1C1.png' @ error/png.c/MagickPNGErrorHandler/1650 TilingModule.exe: Image height exceeds user limit in IHDRC:\inetpub\ICRload\TilingModule\Temp\dfd2cc44-e641-46a9-881c-9b55ae3c7ce6_1C1.png' @ warning/png.c/MagickPNGWarningHandler/1683"

I could do that with previous version of Visual Studio 2010, .NET 4.0, .NET Magick. Now I'm using Visual Studio 2015, .NET 4.5, .NET Magick.
Oct 21, 2015 at 12:20 PM
Edited Oct 21, 2015 at 2:43 PM
We recently added a feature to limit the width and height of an image. The default values are probably too low for you. You can change them with the ResourceLimits class.
Oct 21, 2015 at 2:41 PM
Edited Oct 21, 2015 at 2:41 PM
Thanks for the answer.

I checked this two properties:

And found out that default number for both is 10000000 what is greater than 1633800. Do I missed something or maybe that number means something else(not pixels)? Also I updated Magick .NET to and replaced that number(10000000) on 100000000. And have the same issue.

Also I use this code for testing:
                ResourceLimits.Width = 100000000; 
                ResourceLimits.Height = 100000000; 
                using (var imageCollection = new MagickImageCollection()) //add files in column merger
                    foreach (var file in Directory.GetFiles(path, "*.png"))
                    using (MagickImage mergedImage = imageCollection.AppendVertically())
                        mergedImage.Write(Path.Combine(path, "result.png"));
            catch (Exception ex)
Oct 22, 2015 at 12:28 PM
Edited Oct 22, 2015 at 12:29 PM
I can reproduce the issue. This was changed because we upgraded the libpng library in ImageMagick. The png library also has its own internal limits. And they where lowered in the latest version. We did not set them to our own limits in ImageMagick. I just pushed a fix for this to the GIT repository of ImageMagick. This will be fixed in the next release of Magick.NET.
Oct 22, 2015 at 1:56 PM
Great thanks!

Will waiting new release ;)
Oct 26, 2015 at 10:07 AM

I downloaded new release of library and didn't find any issue with limits. But my application just exit wtihout reporting any error when I'm trying to merge images. It happnes on the last stage when application creates "result.png". Result file has only 107 Kb. And it always has only 107 Kb.
Could you please investigate what is happening?

I'm using code snippet above, and files below. Thanks in advance.
Oct 26, 2015 at 3:28 PM
I will investigate it this weekend. On a trip now with a laptop that doesn't have enough disk space anymore to create this ridiculous large image.
Oct 27, 2015 at 7:26 AM
Okay thanks :) THis images uses in the DeepZoom(like google maps) project. In any way will waiting your answer. Have a wonderful trip ;)
Nov 5, 2015 at 8:38 AM
Hello, dlemstra. So do you have opportunity to test this issue?
Nov 5, 2015 at 11:01 AM
I will take a look at it tonight. Haven't had time to work on this yet.
Nov 6, 2015 at 9:21 AM
I can reproduce your result. Are you able to visually check the output? I am wondering if the image is all black. It might be related to this issue:
Nov 6, 2015 at 1:33 PM
I had the issue with black images. But black images issue something like "floating bug". I couldn't catch situation to reproduce stable effect of bug. According that image. Here it is This is result.png. Of output. 107Kb. And can't be opened with viewer.
Nov 9, 2015 at 12:06 PM
I think I have tracked down the issue. It takes a long time to test it with your images so I was unable to do that this weekend. I will test it with the development build tonight. You could also want to give that a try if you want.
Nov 10, 2015 at 8:04 AM
I took a lot of waiting last night but your issue will be resolved in the next release of Magick.NET. I am still unable to open your image with the default viewers on Windows but the size of the file is now around 2MB.
Nov 10, 2015 at 9:14 AM
Great thanks. Now it looks like normal image. And what about black images? Did you find that issue?
Nov 10, 2015 at 9:29 AM
Edited Nov 10, 2015 at 9:30 AM
I am not a 100% sure but it suspect it was the same issue. The png that was created was always that small size because it contained only black pixels.

I am planning to publish a new release later this week/weekend.