Page 1 of 1

Rendering a single character eat up all memories

Posted: 2014-08-25T21:36:00-07:00
by zxytim
While I am rendering text using:
convert -pointsize 100 -font ./kaiti_GB2312.ttf label:O O.png
convert eat up all my free memory (about 4G). However, if I use smaller font size:
convert -pointsize 50 -font ./kaiti_GB2312.ttf label:O O.png
it works nicely. And more interesting, if I render another character other than 'O', like 'P', using 100 point size,
it also works like a charm:
convert -pointsize 100 -font ./kaiti_GB2312.ttf label:P P.png

I've tried other various fonts (around 1000 kinds, rendering [a-zA-Z0-9]) using the same setting that would fail
on kaiti_GB2312, they all worked smoothly.
I tested this font in LibreOffice, it also worked.

I hypothesize that the problem lies in the incompatibility between imagemagick and this fonts.

The font is uploaded here:
http://www.speedyshare.com/YXRWj/kaiti-GB2312.ttf

Best.

Re: Rendering a single character eat up all memories

Posted: 2014-08-26T04:05:23-07:00
by magick
Your command worked for us without any problems. We're using the ImageMagick 6.8.9-7 with Freetype 2.5.0.

Re: Rendering a single character eat up all memories

Posted: 2014-09-01T00:47:02-07:00
by zxytim
I am using ImageMagick 6.8.9.7 with freetype 2.5.3 (newer that yours) on a arch box.
I did some further experiment on this issue, ends up with following findings:
1. The condition it fails seems like: "-pointsize <n>" where n > 50
2. It will create a fast growing temporary file named like '/tmp/magick-<magic-number>'. As I mount /tmp as tmpfs, this might be the cause of my memory exhaustiveness.

Re: Rendering a single character eat up all memories

Posted: 2014-09-21T02:15:36-07:00
by zxytim
I still encounter the same problem after upgrading freetype to 2.5.3-2.
The problem shows up again when rendering a Chinese character using a different font.
This one works:
convert -pointsize 50 -font ./STXINGKA.TTF label:先 /tmp/xian.png
But this one fails.
convert -pointsize 51 -font ./STXINGKA.TTF label:先 /tmp/xian.png

Furthermore, this problem can also be reproduced on a Debian(sid) box with ImageMagick 6.8.9-6 and freetype 2.4.9-1.1.

Aforementioned font is here: http://speedy.sh/KbFMh/STXINGKA.TTF

I will really appreciate if the cause could be identified. Thank all ImageMagick staff.