chunk data is too large

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
rlunev
Posts: 6
Joined: 2018-07-16T11:49:21-07:00
Authentication code: 1152

chunk data is too large

Post by rlunev » 2018-07-17T08:47:53-07:00

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.

User avatar
dlemstra
Posts: 1475
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra » 2018-07-17T13:41:06-07:00

Could you add a small sample and share the input image on something like onedrive or dropbox so I can reproduce his?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

rlunev
Posts: 6
Joined: 2018-07-16T11:49:21-07:00
Authentication code: 1152

Re: chunk data is too large

Post by rlunev » 2018-07-18T09:31:03-07:00

https://drive.google.com/open?id=1Lmu2L ... XF2OUWfcuA

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

Thanks for looking into this!

User avatar
dlemstra
Posts: 1475
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra » 2018-07-19T11:33:11-07:00

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?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

rlunev
Posts: 6
Joined: 2018-07-16T11:49:21-07:00
Authentication code: 1152

Re: chunk data is too large

Post by rlunev » 2018-07-20T08:13:29-07:00

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;
        }

User avatar
dlemstra
Posts: 1475
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra » 2018-07-20T10:50:19-07:00

And the value of extension is?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

rlunev
Posts: 6
Joined: 2018-07-16T11:49:21-07:00
Authentication code: 1152

Re: chunk data is too large

Post by rlunev » 2018-07-20T11:43:05-07:00

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('.');

User avatar
dlemstra
Posts: 1475
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra » 2018-07-21T08:49:48-07:00

And can you explain at which moment you get that exception?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

rlunev
Posts: 6
Joined: 2018-07-16T11:49:21-07:00
Authentication code: 1152

Re: chunk data is too large

Post by rlunev » 2018-07-23T06:47:27-07:00

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 });

User avatar
dlemstra
Posts: 1475
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra » 2018-07-24T21:37:43-07:00

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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

rlunev
Posts: 6
Joined: 2018-07-16T11:49:21-07:00
Authentication code: 1152

Re: chunk data is too large

Post by rlunev » 2018-07-30T12:47:08-07:00

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

Post Reply