[英]MagickNET exception when resample PixelCacheAllocationFailed
I use MagickNET in a ASP .NET application. 我在ASP .NET应用程序中使用MagickNET。 Usually it's works but sometimes with somes files (.jpg, .png) I receive an exception when I resample the picture with another DPI
通常它是可行的,但有时可以使用某些文件(.jpg,.png),当我使用另一个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
ImageMagick.MagickResourceLimitErrorException:iisexpress.exe:PixelCacheAllocationFailed`D:\\ Data \\ IT工具和应用程序\\ Code \\ Zola \\ ZolaIntranet \\ Upload \\ Temp \\ 4ffe031b-b559-4b5c-8f88-e1a5b8e4fbe7.jpg'@错误/cache.c/OpenPixel / 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 : 当我尝试使用较小的DPI(72或更小)时,出现了另一个异常:
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
ImageMagick.MagickCacheErrorException:iisexpress.exe:UnableToExtendCache'D:\\ Data \\ IT工具和应用程序\\ Code \\ Zola \\ ZolaIntranet \\ Upload \\ Temp \\ 42458df9-f7ee-4e4b-abfd-628317b4b7eb.jpg':无效的参数@错误/缓存。 c / OpenPixelCache / 3536 ---> ImageMagick.MagickCacheErrorException:iisexpress.exe:UnableToExtendCache
Can someone have an idea ? 有人可以有个主意吗?
For one or another reason, for few pictures in PNG format ImageMagick cant't find the density of the picture. 由于一个或另一个原因,对于PNG格式的几张图片,ImageMagick无法找到图片的密度。 You have to specify a density before calling
Resample()
function and that resolve my problem. 您必须在调用
Resample()
函数之前指定密度,这样才能解决我的问题。
PointD density = new PointD(300,300);
tmpImage.Density = density;
tmpImage.Resample(density);
tmpImage.Write(image);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.