cache resources exhausted Imagemagick

依然范特西╮ 提交于 2019-12-23 15:16:31

问题


I'm using Imagemagick on a rails app with Minimagick and i generate some pictogram with it.

When i launch my process i have this error and i don"t find solution

MiniMagick::Error (`convert -limit memory 2GiB -limit map 2GiB -limit   disk 4GiB -background none -fill #000000 -font ttf/SELIS006N.ttf -pointsize 300 label: S public/pictogram_images/RECINTAN-EL-064-layer-1.png` failed with error:
convert.im6: cache resources exhausted ` S' @ error/cache.c/OpenPixelCache/4078.
convert.im6: no images defined `public/pictogram_images/RECINTAN-EL-064-layer-1.png' @ error/convert.c/ConvertImageCommand/3044.
):

My process is simple, i have some .tff file and each character is a pictogram. I just want to generate all preview of this character in png


回答1:


Find the policy.xml with find / -name "policy.xml"

something like /etc/ImageMagick-6/policy.xml

and change <policy domain="resource" name="disk" value="1GiB"/> to <policy domain="resource" name="disk" value="8GiB"/>

refer to convert fails due to resource limits

Memory issues




回答2:


Not sure exactly which item is causing you the problem, but it is probably one of these:

1) You need to put your font into ImageMagick's XML-based font file rather than specify a file.ttf in your convert command. To get the list of available fonts, use

identify -list font | more

Path: /Users/mark/.magick/type.xml          <--- Edit your font into here
  Font: ACaslonPro
    family: unknown
    style: Undefined
    stretch: Undefined
    weight: 0
    glyphs: /Library/Fonts/ACaslonPro-Regular.otf
  Font: ACaslonPro-Semibold
    family: unknown
    style: Undefined
    stretch: Undefined
    weight: 0
    glyphs: /Library/Fonts/ACaslonPro-Semibold.otf
...
...

At the beginning you will see the path to the config file for your fonts and you need to edit that to include your TTF file you mentioned. If you have lots of fonts to add, you may like to automate the process - see my other post here.

2) You may need to escape the # in your -fill option, or at least surround it by single, or double quotes to hide it from the shell, if your MiniMagick invokes via shell - I don't know the ins and outs of MiniMagick.

3) You may need to quote the letter S that you wish to output inside single or double quotes.

4) You may need to remove the space after the colon following label.

What I am getting at is that your command should maybe be more like this:

convert -limit memory 2GiB -limit map 2GiB -limit   disk 4GiB -background none -fill "#000000" -font "TimesNewRoman" -pointsize 300 label:"S" output.png


来源:https://stackoverflow.com/questions/31407010/cache-resources-exhausted-imagemagick

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!