1

I use MagickNET in a ASP .NET application. Usually it's works but sometimes with somes files (.jpg, .png) I receive an exception when I resample the picture with another DPI

ImageMagick.MagickResourceLimitErrorException: iisexpress.exe: PixelCacheAllocationFailed `D:\Data\IT Tools and Applications\Code\Zola\ZolaIntranet\Upload\Temp\4ffe031b-b559-4b5c-8f88-e1a5b8e4fbe7.jpg' @ error/cache.c/OpenPixelCache/3369

Here the line where the exception happens :

 tmpImage.Resample(new PointD(300,300));

When I tried to use a smaller DPI (72 or less) I got another exception :

ImageMagick.MagickCacheErrorException: iisexpress.exe: UnableToExtendCache 'D:\Data\IT Tools and Applications\Code\Zola\ZolaIntranet\Upload\Temp\42458df9-f7ee-4e4b-abfd-628317b4b7eb.jpg': Invalid argument @ error/cache.c/OpenPixelCache/3536 ---> ImageMagick.MagickCacheErrorException: iisexpress.exe: UnableToExtendCache

Can someone have an idea ?

  • Can you share that image? Feel free to contact me on CodePlex if you don't want to do that publicly. – dlemstra Dec 16 '15 at 19:49
  • Hi diemstra. Sure, here the picture http://postimg.org/image/wpv7rh0kh/ What I remarked, when I tried to open this same picture with Gimp, I had also a message : ... this image has a color profil... Thanks in advance. – Dervis Findik Dec 17 '15 at 07:54
  • I am unable to reproduce your issue with the latest development build could you give that a try? Instructions are on https://magick.codeplex.com – dlemstra Dec 18 '15 at 18:33
  • I'm already on the last version (7.0.0.22), Q8 package and with .NET 4.5 and I had some strange problem with the png format files. The previous problem it's not solved and the problem come from the same function : resample(). Sometimes it even doesn't give me any error but it continue to work with no result. Other functions like the write() or crop() (png to jpg) works nice and quickly – Dervis Findik Dec 23 '15 at 13:52

1 Answers1

0

For one or another reason, for few pictures in PNG format ImageMagick cant't find the density of the picture. You have to specify a density before calling Resample() function and that resolve my problem.

PointD density = new PointD(300,300);

tmpImage.Density = density;
tmpImage.Resample(density);
tmpImage.Write(image);