Antialiasing and fonts

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
fantomas

Antialiasing and fonts

Post by fantomas »

Hello,

I make websites, and use FLIR image replacement ( http://facelift.mawhorter.net/ ) technique for text rendering.
With FLIR I have two choices - either using GD or IM.
Judging from experiments with a given font, GD results worse then with IM, so I decided to continue with IM and get appropriate picture.

The problem is how anti-aliasing works for a font. Are there any ways to modify AA behaviour in IM?
For example, this image illustrates different settings for AA in Adobe Photoshop (right column) and AA in IM (left column):

http://www.onlinedisk.ru/view/261136

To get this picture I first drawn right column in PS, exported it in PNG and then wrote text in IM:

convert out/fonts_test_18px.png \
-font Fonts/PF_Din_Text_Comp_Pro_Regular.ttf \
-fill red \
-density 72 \
-pointsize 18 \
+antialias \
-annotate 0x0+60+55 "ЗАПЧАСТИ ДЛЯ МАШИН AA = Off" \
-antialias \
-annotate 0x0+60+105 "ЗАПЧАСТИ ДЛЯ МАШИН AA = On" \
-annotate 0x0+60+155 "ЗАПЧАСТИ ДЛЯ МАШИН AA = On" \
-annotate 0x0+60+205 "ЗАПЧАСТИ ДЛЯ МАШИН AA = On" \
-annotate 0x0+60+255 "ЗАПЧАСТИ ДЛЯ МАШИН AA = On" \
out/out.png

As you can see, letters "A", "M" looking not nice at all. Any ideas how to enhance AA in IM for my case?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Antialiasing and fonts

Post by fmw42 »

I don't know if it will help, but you can try adding -stroke red and/or -strokewidth X, where X = 0,1,2...

see http://www.imagemagick.org/Usage/draw/#stroke
fantomas

Re: Antialiasing and fonts

Post by fantomas »

Thank you for reply and suggestion - I tried stroke with different -strokewidth , result is not appropriate yet.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Antialiasing and fonts

Post by fmw42 »

try -draw rather than -annotate. Not sure if -annotate is sensitive to -antialias (probably is, but won't hurt to try -draw)

see http://www.imagemagick.org/Usage/draw/

also see other options at http://www.imagemagick.org/script/magic ... aphics.php
Post Reply