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 »

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: 1594
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra »

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 »

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: 1594
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post 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?
.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 »

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: 1594
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra »

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 »

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: 1594
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post by dlemstra »

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 »

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: 1594
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: chunk data is too large

Post 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.
.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 »

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