Page 1 of 1

Font Spacing Problem between Photoshop and ImageMagick

Posted: 2010-07-24T07:26:10-07:00
by debakar
Hello Experts,

I am baffled with font spacing problem between photoshop and imagemagick. I am trying to explain the problem below:

1. I open Photoshop, create a new file, white background, 72dpi RGB.
2. I choose "Impact" font, 70pt, Sharp. All other character settings are default (such as Auto, 0, 100% etc).
3. I write the text "Engaging" using the text tool.

Now, I use imagemagick to generate the same text using the following command:

Code: Select all

convert -depth 8 -density 72 -background transparent -fill red -font './impact.ttf' -pointsize 70 label:'Engaging' text_test.png
Note that I have copied the impact.ttf font from my C:\Windows\Fonts directory to the folder where I am executing the convert command. So both Photoshop and ImageMagick are using the same font file.

Next, I open the text_test.png file in Photoshop, copy all, paste it on my previous file as a new layer. What I see is, the height of the characters are perfectly fine, but the width of text generated from ImageMagick is less than that in photoshop. I am not sure if the spacing is less or width of each character, but somehow the text generated with ImageMagick does not match that in photoshop.

Here is a screenshot of the above problem to help understand the problem:

Image

Can anyone guide me if I am doing anything wrong? Any help will be highly appreciated.

Thank You.

Re: Font Spacing Problem between Photoshop and ImageMagick

Posted: 2010-07-24T07:49:54-07:00
by fmw42
Change the kerning value in IM. http://www.imagemagick.org/script/comma ... hp#kerning

Perhaps IM and PS have different defaults.

Re: Font Spacing Problem between Photoshop and ImageMagick

Posted: 2010-07-24T08:12:49-07:00
by debakar
This is not an option. We are developing a flash tool to create a design letterhead and then generating the same on server using ImageMagick. We have successfully done all but the text rendering due to this problem. User can choose any font in his design. I posted this topic using Impact font because the difference appears to be maximum with this font. I cannot keep on experimenting with what kerning value will be required for which font.

My question is, even if everything is default in both Photoshop & ImageMagick, why would the text differ so much? Even flash displays the font in same size as does Photoshop. Comparing a screenshot taken from the flash tool and text drawn in Photoshop shows absolutely no difference, but the same generated with ImageMagick has an appreciable difference. And the fun part is, the difference is different depending on which font is used. Impact font was selected for my post to explain the problem.

Re: Font Spacing Problem between Photoshop and ImageMagick

Posted: 2010-07-26T06:50:04-07:00
by debakar
Hello everyone there,

Can anyone throw some light on this problem? I am eagerly waiting for a direction.
Thanks.
DK

Re: Font Spacing Problem between Photoshop and ImageMagick

Posted: 2010-07-27T18:06:37-07:00
by anthony
The problem is with the rendering engine, not with ImageMagick.

ImageMagick calls a external library "freetype" to do the font drawing. As such the issue will need to be taken up with the developers of that library.

Re: Font Spacing Problem between Photoshop and ImageMagick

Posted: 2010-08-02T08:41:53-07:00
by debakar
I upgraded freetype and freetype-devel to version 2.2.1-21.el5_3 through yum.

Code: Select all

yum update freetype
A test after that did not show any change. I then went ahead and updated ImageMagick to ImageMagick-6.6.3-2 (the installed version was ImageMagick-6.6.2-9). After that it all worked fine. Now the same test done above in the start of this post shows negligible difference in the text in Photoshop and generated through IM.

Thank you very much for the direction.