Page 1 of 1

Text on Transparent background

Posted: 2007-08-23T12:44:43-07:00
by chnet
I'm simply trying to draw white text onto a transparent background and save it as a transparent PNG but it's not working as expected. Instead of being pure white and semi-transparent, it has black artifacts, as if the text was written on black, and then cut out.

My Command:

Code: Select all

convert -size 203x29 xc:none -font ACaslonPro-Semibold.otf -pointsize 15 -draw " fill "#FFFFFF" text 26,19 'Home'" output.png
If you look at the examples below, you can see that when I draw the text over a black background (fig. C), it looks nice and smooth. But if I draw it over a transparent background, it comes out jagged (fig A. and B). The root of the problem appears to me when you place the transparent image over a white background with photoshop (fig. D). You can see, rather than semi-transparent WHITE edges, it has semi-transparent BLACK edges.

What am I doing wrong?

Examples of what is happening:
Image

Re: Text on Transparent background

Posted: 2007-08-23T14:54:35-07:00
by el_supremo
Your text is probably being antialiased. Add the option +antialias before the -font option.

Pete

Re: Text on Transparent background

Posted: 2007-08-23T20:33:55-07:00
by chnet
Well I would like to have the antialias on so the font is smooth.

Is there a way to do this with it still on?

Re: Text on Transparent background

Posted: 2007-08-24T22:10:19-07:00
by anthony
You are experiencing the very OLD text halo bug...
Which was fix for text, resize and blur around IM v6.2.4

Also watch you quoting... You are unquoting the fill color within the drawing command!


I suggest you upgrade ASAP!

Note you are also missing out on cool updates for GIF animation handling, Order Dither, and most recently Image Distortion. That latter will also have a MAJOR improvement in output results very soon, as I am just finialising the programing of
Elliptical Weighted Re-sampling methods.

Re: Text on Transparent background

Posted: 2007-08-27T11:03:24-07:00
by chnet
Anthony, thanks for your response.

I am using Imagemagick 6.3.5 or at least thats what it tells me when I enter the command:

Code: Select all

convert -version
which outputs:
Version: ImageMagick 6.3.5 08/23/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

Any ideas what could be the problem?

Re: Text on Transparent background

Posted: 2007-08-27T11:23:17-07:00
by chnet
ah ha, it seems my server has two installations, php was using one that was 5.4

So I think that'll fix it after I sort that problem out.

Thanks!!!