rendering text performance - very poor
rendering text performance - very poor
Hi All.
I did some benchmarks on the library and found that drawing text on an image is very slow in comparison to composing images.
When I say very slow I mean by a factor of 10 approximatley.
I am running with one thread only.
What can be the cause of this?
Does the library reads the font from the disk every drawing ?
Is the time spent looking in the SplayTree for configuration ?
I am using the list<Drawable>, is this a problem ?
Thanks,
Ronen.
I did some benchmarks on the library and found that drawing text on an image is very slow in comparison to composing images.
When I say very slow I mean by a factor of 10 approximatley.
I am running with one thread only.
What can be the cause of this?
Does the library reads the font from the disk every drawing ?
Is the time spent looking in the SplayTree for configuration ?
I am using the list<Drawable>, is this a problem ?
Thanks,
Ronen.
Implementing the font caching in ImageMagick will be quite time consuming to do it properly. Instead consider sending us a stripped down code/script of what you are doing and we will run a profile to see if we can identify opportunities for speed-ups. If we reproduce the slow-down you are getting, perhaps we can shoot for a short term improvement.
Code: Select all
try
{
mImage = new Image();
mImage->size(Geometry(fWidth,fHeight));
mImage->backgroundColor(fColor.getColor());
mImage->erase();
// render the text.
list<Drawable> drawList;
drawList.push_back(DrawableFont(fFontFace,fFontSyle,fFontWeight,NormalStretch));
drawList.push_back(DrawablePointSize(fFontSize));
drawList.push_back(DrawableTextDecoration(fTextDecoration));
drawList.push_back(DrawableGravity(fGravity));
drawList.push_back(DrawableFillColor(fFontColor));
drawList.push_back(DrawableText(0,0,fText,"UTF-8"));
mImage->draw(drawList);
}
catch (Magick::Exception& err)
{
LOG_MESSAGE
return false;
}
This solution is problematic for us because we render text on various Imageg and not only on one. if I understand your suggestion, this may help when all text item are on the same Image object.
do you have any idea on how can we improve our performance and still render text on more then one Image?
Thanks,
Ronen.
do you have any idea on how can we improve our performance and still render text on more then one Image?
Thanks,
Ronen.
Hi and thanks for the quick response.
in order for us to render text directly with the Freetype library, we need to copy a huge amount of code from annotate.c in order to gain all the functionality we used up until now.
can you point out the place in the code where the fonts and glyphs are read from the file and not cached. I am trying to find the easiest way to use Freetype and ImageMagic to accomplished that.
Thanks,
Ronen.
in order for us to render text directly with the Freetype library, we need to copy a huge amount of code from annotate.c in order to gain all the functionality we used up until now.
can you point out the place in the code where the fonts and glyphs are read from the file and not cached. I am trying to find the easiest way to use Freetype and ImageMagic to accomplished that.
Thanks,
Ronen.
Hi,
I used this information of FT_Open_Face that read the font from the file and it was very helpful.
My question is whether there are more actions that are "heavy" in performance.
I have some other suspects I wanted to ask about.
FT_Attach_File (also open file?)
FT_Load_Glyph
and FT_Init_FreeType - is there a problem to init the library only once instead of each time we render text? is it a heavy action?
Thanks in advance,
Ronen.
I used this information of FT_Open_Face that read the font from the file and it was very helpful.
My question is whether there are more actions that are "heavy" in performance.
I have some other suspects I wanted to ask about.
FT_Attach_File (also open file?)
FT_Load_Glyph
and FT_Init_FreeType - is there a problem to init the library only once instead of each time we render text? is it a heavy action?
Thanks in advance,
Ronen.
Hi there,
I asked you some monthes ago, about the performance of text rendering on an image and the reply was that text caching is not yet supported in ImageMagick but is on the "todo list".
are there any news on the subject? is this supported in the new versions of the library?
Thanks in advance,
Ronen.
I asked you some monthes ago, about the performance of text rendering on an image and the reply was that text caching is not yet supported in ImageMagick but is on the "todo list".
are there any news on the subject? is this supported in the new versions of the library?
Thanks in advance,
Ronen.