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?".

Antialiasing and fonts

Postby fantomas » 2009-11-07T04:27:42+00:00

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?
fantomas
 
Posts: 2
Joined: 2009-11-07T04:16:09+00:00

Re: Antialiasing and fonts

Postby fmw42 » 2009-11-07T09:31:03+00:00

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
fmw42
 
Posts: 2746
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: Antialiasing and fonts

Postby fantomas » 2009-11-07T12:13:45+00:00

Thank you for reply and suggestion - I tried stroke with different -strokewidth , result is not appropriate yet.
fantomas
 
Posts: 2
Joined: 2009-11-07T04:16:09+00:00

Re: Antialiasing and fonts

Postby fmw42 » 2009-11-07T12:29:47+00:00

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
fmw42
 
Posts: 2746
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA


Return to Users

Who is online

Users browsing this forum: MSN [Bot], Yahoo [Bot] and 5 guests