Page 1 of 1

IM / Trouble with Font Output

Posted: 2009-08-10T22:26:57-07:00
by tenlethar
Hello there,

i am having trouble generating properly rendered text output. The result always looks incredibly thin and unenjoyable in the given visual context. I am using the "Tahoma" font, but i embed it as ttf. I tried using the internal variant, but it did not change the matter.

This is what the rendered output from ImageMagick looks like:

Image

And this is what it should look like:

Image
(This example is created in Photoshop. The graphic designer used the same TTF font there, Anti-Alias set to SHARP. Setting it to STRONG also looks fine and the way he wants it to. The other modes don't. The font size in Photoshop is 13,49 pt)

Here is how i call IM to get the results shown in the first image:

Code: Select all

convert -size 180x28 xc:rgba(0,0,0,0) -font "fonts/tahoma.ttf" -pointsize 13,49 -fill "rgba(171,171,171,1)" -gravity north-west -draw "text 0,3 'WELCOME'" img/dynamic/titles/dark/5995d98caf31b9445202b0f054fdc54e.png
I really need to find a way to deal with this issue. Since i can't expect Tahoma to be given on all visitor's systems, i have to generate those title images using IM. GD is not an option - not only am i deeply annoyed by it - it just does not do the job. IM is the chief force engineer of my dynamic graphics spacecraft :)

Any kind of help would be deeply appreciated!

Thank you very much!

----

My IM version:

Code: Select all

Version: ImageMagick 6.5.4-9 2009-08-04 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Re: IM / Trouble with Font Output

Posted: 2009-08-11T00:10:50-07:00
by anthony
First step... Look at IM examples, text to Image Conversion....

http://www.imagemagick.org/Usage/text/

It will probably have all the answers you need.


Also what exactly is the issue? Image size, font being used? Aliasing?

You touch upon a lot of things but don't ask anything specific!

Re: IM / Trouble with Font Output

Posted: 2009-08-11T00:21:28-07:00
by tenlethar
Dear Anthony,

thanks for getting into it. I have gone through the examples very often but i could not find the reason or source of my problem there.

I thought that showing the pictures of what i do achieve and what i would like to achieve, would keep the matter clear. The point is - i do not know where the problem lies. I assume it is Anti-Aliasing, but i am not sure since this is not really my area of expertise.

Basically i am looking for a way to render the text output in a way so that it most precisely resembles the corresponding text layers in the Photoshop screendesign given to me by the graphic designer (as in image example 2, above).

Is there any way i can let ImageMagick use a different Anti-Aliasing algorythm? Such as Photoshop can use various algorythms to render text?

Thank you in advance!

Leonidas

Ps.: I also found a posting on the net from a person with a similar (appearing) problem. He did not quite find a solution but he said that it looked better for him when he doubled font size, then downsampled 50%. I tried that but ended up with a result worse than what i already got :(

Re: IM / Trouble with Font Output

Posted: 2009-08-11T01:45:33-07:00
by anthony
The first thing is to get the font looking right and the only real way to do that is to use the right TTF font. Tarying to get any other font to look like a specific one is pretty well impossible!

The font also defined the height and spacing of the letters.

As for use the font at a different scale and downsizing, their are more factors than just pointsize, their is also density.

Photoshop bring a GUI probably knows the resolution of your display and adjusts the density accordingly making the font bigger or smaller pixel-wise. ImageMagick being a batch processing program does not know this and defaults to a fixed 72 dpi, unless otherwise changed. Most displays these days are 90 to 120 dpi resolution.

If you decided to resize a fotn draw bigger you have many more options, such as filters and other controls that can effect the sharpness or bluriness of the final image.


Rather than -draw I would start with label: as it will first generate a image the right size for the string given, and also has other options such as sizing the font to fit a specific sized box, with or without centering.



I think their may be a control for the anti-aliasing options of text rendering but I do not know what they are at this time. Sorry.

Re: IM / Trouble with Font Output

Posted: 2009-08-11T05:56:24-07:00
by tenlethar
To assure usage of the correct TTF font, i copied the one in my Fonts directory. It is exactly the one that Photoshop is using.

Is there any way i can raise the DPI in order to obtain a more dense font rendering?

And: do you mean that if i render the font much bigger, use various filters on it, then downsample it, i could end up with a more accurate result?

Thank you.
Kind regards and greetings from Austria!

Re: IM / Trouble with Font Output

Posted: 2009-08-11T08:11:42-07:00
by fmw42
what is -pointsize 13,49 Is that 13 or 49? I don't think you can specify pointsize this way. Only one number as far as I know. but I will defer to the experts.

Re: IM / Trouble with Font Output

Posted: 2009-08-12T19:18:31-07:00
by anthony
One number only! probably 13.

Resolution can be set with -density