David Reitter on  wrote...
| I'm trying to render text in an image that is to be output in an  
| indexed-color format (GIF, XPM) with a designated transparent color.
| 
| Unfortunately, the text in the resulting image is absolutely  
| unreadable - it seems as if most of the text is converted to  
| transparent pixels. It works fine when I output to PNG instead, but I  
| ultimately need XPM.
| 
| I'm using the following construction to add my text:
| 
| montage -fill black -font "Helvetica" -size 9 -geometry +0+0 -label  
| "hello" -background transparent trans.gif test.gif
| 
| I'm attaching the input file trans.gif and the result test.gif. The  
| same problem occurs if I add the text, save as PNG and then convert  
| it to GIF. I'm using ImageMagick 6.2.7  on OS X.
| 
| I couldn't find anything about this in the doc or via sensible Google  
| searches...
| 
You image was not attached. but looking at the command, you are using a
very thin font "Helvetica" at a small size (12 point).

The "-size 9" setting will not be used.

Now at a small size most of the text will be rendered mostly as
semi-transparent pixels on a transparent background.

The problem is nothing to do with using a indexed image format, but
a format that uses a boolean or on/off transparency method.  Eg no
semi-transparent pixels are posible.

As the GIF and XPM formats are of this type, resulting in any pixel
which is semi-transparent becomming either opaque  or transparent,
depending on the version of IM you are using.  PNG does not have that
limitation, which is why it is a prefered image format for modern
applications.

Try this...

  convert test.png   test_def.gif
  convert test.png -channel A -threshold 80%  test_70.gif
  convert test.png -channel A -threshold 30%  test_30.gif

The first is what you were getting. The second (70% threshold) is
makes a lot more of the semi-transparent pixels opaque, making the text
readable.  The thrid is the oppisite. only pixels which are at least 30%
opaque are made opaque.

This method will let you control the GIF thresholding level for
semi-transparency, which you obviously need.


For more info see 
  IM Examples,  GIF Boolean Transparency
   http://www.cit.gu.edu.au/~anthony/graphics/imagick6/formats/#trans


What I would like to see is a new setting to control the boolean
threshold level for GIF and XPM formats.  This method should NOT be
linked with -fuzz what has a very different function, though in is some
versions of IM linked to this problem.


  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
  Glad to be of service!    --- A Door - ``Hitchhikers Guide to the Galaxy''
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to