Page 1 of 1

chunk data is too large

Posted: 2018-07-17T08:47:53-07:00
by rlunev
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 in one of the releases. Any help is appreciated.

Re: chunk data is too large

Posted: 2018-07-17T13:41:06-07:00
by dlemstra
Could you add a small sample and share the input image on something like onedrive or dropbox so I can reproduce his?

Re: chunk data is too large

Posted: 2018-07-18T09:31:03-07:00
by rlunev
https://drive.google.com/open?id=1Lmu2L ... XF2OUWfcuA

Please let me know if you can get to this image.

Thanks for looking into this!

Re: chunk data is too large

Posted: 2018-07-19T11:33:11-07:00
by dlemstra
I have the image and I can read it without any issues. Can you also post a small code sample that I can use to reproduce the issue?

Re: chunk data is too large

Posted: 2018-07-20T08:13:29-07:00
by rlunev

Code: Select all

public byte[] GenerateThumbnail(byte[] fileData, string extention)
        {
            if (fileData == null || fileData.Length == 0)
            {
                EventLogProvider.LogEvent("E", "ThumbnailProvider", "GENERATETHUMBNAIL", $"Data for creating thumbnail is empty");
                return null;
            }

            byte[] generatedThumbnail = null;
            var format = MagickFormat.Unknown;

            if(!Enum.TryParse(extention, true, out format))
            {
                throw new InvalidDataException($"Unrecognized format: {extention}");
            }

         
			using (var image = new MagickImage(fileData, new MagickReadSettings { Format = format }))
			{
				image.Resize(new MagickGeometry(200) { IgnoreAspectRatio = false, Greater = true, Less = false, FillArea = false });
				image.Format = _defaultOutputFormat;
				generatedThumbnail = image.ToByteArray();
			}
			break;
          

            generatedThumbnail = CompressThumbnail(generatedThumbnail);

            return generatedThumbnail;
        }

Re: chunk data is too large

Posted: 2018-07-20T10:50:19-07:00
by dlemstra
And the value of extension is?

Re: chunk data is too large

Posted: 2018-07-20T11:43:05-07:00
by rlunev
It is tif as we are trying to resize the image that I send you the link for. Here is the code to extract that extension

var extension = file.FileName;
extension = Path.GetExtension(extension).TrimStart('.');

Re: chunk data is too large

Posted: 2018-07-21T08:49:48-07:00
by dlemstra
And can you explain at which moment you get that exception?

Re: chunk data is too large

Posted: 2018-07-23T06:47:27-07:00
by rlunev
I am getting exception at the following line. Sorry I thought I mentioned that it happens on resize.

image.Resize(new MagickGeometry(200) { IgnoreAspectRatio = false, Greater = true, Less = false, FillArea = false });

Re: chunk data is too large

Posted: 2018-07-24T21:37:43-07:00
by dlemstra
I just did a search for the text `chunk data is too large` in the code of ImageMagick and it turns out that this only will happen when a .PNG file is being read. I have no clue how I can reproduce your issue with the image and the sample code that you provided.

Re: chunk data is too large

Posted: 2018-07-30T12:47:08-07:00
by rlunev
I was trying to send multiple files so I posted one of them. Below is the png file so you can troubleshoot this. Please let me know if you can access it.

https://drive.google.com/open?id=1QP6RV ... 7DEiHyHb0x