|
List Info
Thread: Rendering text -> unreadable in GIF or XPM
|
|
| Rendering text -> unreadable in GIF
or XPM |

|
2006-05-18 13:58:41 |
Hi,
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...
Any suggestions?
Many thanks in advance.
- Dave
--
http://aquamacs.org --
Aquamacs: Emacs on Mac OS X
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|
|
| Rendering text -> unreadable in GIF
or XPM |

|
2006-05-18 22:44:58 |
On Thu, 18 May 2006 14:58:41 +0100, David Reitter wrote:
Hi David
The 2 attachments I received are:
(1)
> --
> http://aquamacs.org
-- Aquamacs: Emacs on Mac OS X
(2)
> _______________________________________________
>Magick-users mailing list Magick-users imagemagick.org
> http://studio.imagemagick.org/mailman/listinfo/magick
-users
Put your images somewhere we can download them...
--
Cheers
Ron Savage, ron savage.net.au on 19/05/2006
http://savage.net.au/
index.html
Let the record show: Microsoft is not an Australian company
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|
|
| Rendering text -> unreadable in GIF
or XPM |

|
2006-05-18 23:49:25 |
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/ima
gick6/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 ) <A.Thyssen griffith.edu.au>
-----------------------------------------------------------
------------------
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
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|
|
| Rendering text -> unreadable in GIF
or XPM |

|
2006-05-19 10:53:14 |
On 19 May 2006, at 00:49, Anthony Thyssen wrote:
> 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.
Yes, that makes sense.
I already deal with this for the original image that I'm
converting
by blending the semi-transparent pixels with a presumed
background
color. The fully transparent pixels are then designated as
such when
converting to GIF.
However, this absolutely doesn't work for the rendered
text.
Have a look at this sample (my attachments seem to be
filtered):
http://www.da
vid-reitter.com/trans.html
Here's the code that produced it:
# resize source file
convert "$P/$file" -resize x28 small.miff
# add text label
montage -fill blue -font "Helvetica"
-pointsize 11 -geometry +0
+0 -label "$" -background transparent
small.miff small-text.miff
# draw same-size background
composite -size 28x28 xc:$BGCOL -compose copy
small-text.miff
mask.miff
# and compose the two so that alpha blended pixels
(<100%
transp) are mixed
composite small-text.miff -compose atop mask.miff
apmask.miff
# convert to gif so we can pick the transparency
convert apmask.miff -transparent $BGCOL trans.gif
# and convert to target format
convert trans.gif `basename "$file"
\.png`.xpm
Suggestions appreciated, also if there is a more elegant way
to do
the above.
- D
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|
|
| Rendering text -> unreadable in GIF
or XPM |

|
2006-05-22 00:12:37 |
David Reitter on wrote...
| On 19 May 2006, at 00:49, Anthony Thyssen wrote:
|
| > 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.
|
| Yes, that makes sense.
|
| I already deal with this for the original image that I'm
converting
| by blending the semi-transparent pixels with a presumed
background
| color. The fully transparent pixels are then designated as
such when
| converting to GIF.
|
| However, this absolutely doesn't work for the rendered
text.
| Have a look at this sample (my attachments seem to be
filtered):
|
| http://www.da
vid-reitter.com/trans.html
|
| Suggestions appreciated, also if there is a more elegant
way to do
| the above.
|
I suggest you switch to a 'terminal' font designed to be
drawn as a
bitmap. Helvetica is NOT such a font.
Also use the 'threhold' control I explained in my previous
email and in
IM Examples, formats, GIF to remove any 'IM version
threshold' problem
you may have.
Basically you have a difficult problem, which I cant help
you with.
For testing I suggest you use the simpler command...
convert -font "NimbusRomanNo9" -pointsize 12
-background none \
label:File t.gif
display -remote t.gif &
The -remote means display in an existing display window if
one exists,
otherwise start one.
You can also try the +antialias setting though I have not
had much
success with it for font drawing.
If you find a good font, or any other interesting point,
PLEASE let me
know. I am sure a lot of people would like a BITMAP drawn
font for use
in GIF images, especially with transparent backgrounds.
Anthony Thyssen ( System Programmer ) <A.Thyssen griffith.edu.au>
-----------------------------------------------------------
------------------
The most exciting phrase to hear in science, the one that
heralds new
discoveries, is not "Eureka!" (I found it!)
but "That's funny ..."
--
Isaac Asimov
-----------------------------------------------------------
------------------
Anthony's Home is his Castle http://www.cit.gu.
edu.au/~anthony/
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|
|
| Rendering text -> unreadable in GIF
or XPM |

|
2006-05-22 06:46:38 |
On 22 May 2006, at 01:12, Anthony Thyssen wrote:
> I suggest you switch to a 'terminal' font designed to
be drawn as a
> bitmap. Helvetica is NOT such a font.
I can try this, but unfortunately, it is not one of my
options in
terms of the requirements of this job. The font will need to
be the
system font that is usually used under icons. This looks the
same in
all applications, and as far as I know, it's a vector font
which
looks great at that point size.
> Also use the 'threhold' control I explained in my
previous email
> and in
> IM Examples, formats, GIF to remove any 'IM version
threshold'
> problem
> you may have.
OK, thanks for that pointer. The threshold parameter as per
your e-
mail made it look ugly.
I think I solved the problem in the way I described in my
e-mail:
assume a fixed background color, use `composite' to render
background
and image with alpha channel, then convert to GIF using the
background color to define the transparency mask. The
non-1000%
background pixels will then be locked to the assumed color,
the
surrounding regions will be transparent. That way, it'll
still look
good on slightly different backgrounds.
(The reason it didn't work for me before was a bug - the
size given
for the background fill image was too small.)
- D
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|
|
| Rendering text -> unreadable in GIF
or XPM |

|
2006-05-22 07:00:20 |
David Reitter on wrote...
| On 22 May 2006, at 01:12, Anthony Thyssen wrote:
|
| > I suggest you switch to a 'terminal' font designed
to be drawn as a
| > bitmap. Helvetica is NOT such a font.
|
| I can try this, but unfortunately, it is not one of my
options in
| terms of the requirements of this job. The font will need
to be the
| system font that is usually used under icons. This looks
the same in
| all applications, and as far as I know, it's a vector
font which
| looks great at that point size.
|
In that case add a background. or use PNG.
System fonts are handled by being drawn onto the background.
Or add a background color that is very close, and make
anything still
that background color transparent. This is the technique
described in
the IM Examples, Common Formats, GIF, Background
Transparency.
| > Also use the 'threhold' control I explained in my
previous email
| > and in
| > IM Examples, formats, GIF to remove any 'IM version
threshold'
| > problem
| > you may have.
|
| OK, thanks for that pointer. The threshold parameter as
per your e-
| mail made it look ugly.
|
Any GIF wiuth transparency will look horrible, unless the
image is given
a color 'halo' like effect that matches the existing
background. It is
about the only way to do near-anti-aliasing with a GIF
boolean
transparency.
| I think I solved the problem in the way I described in my
e-mail:
| assume a fixed background color, use `composite' to
render background
| and image with alpha channel, then convert to GIF using
the
| background color to define the transparency mask. The
non-1000%
| background pixels will then be locked to the assumed
color, the
| surrounding regions will be transparent. That way, it'll
still look
| good on slightly different backgrounds.
|
There you go!
Anthony Thyssen ( System Programmer ) <A.Thyssen griffith.edu.au>
-----------------------------------------------------------
------------------
Beware the kite eating trees! -- Charlie Brown
-----------------------------------------------------------
------------------
Anthony's Home is his Castle http://www.cit.gu.
edu.au/~anthony/
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|
|
[1-7]
|
|