Page 1 of 1

Transparency bug? or am I doing something wrong?

Posted: 2008-07-09T13:17:10-07:00
by dognose
If I change the fill color to red, the background is transparent and the text is red.

If I change the fill color to white, the background is black and the text is transparent!

convert -size 150x150 xc:none -fill "white" -pointsize 50 -draw "text 10,125 'text'" text.gif

convert --version
Version: ImageMagick 6.4.2 07/08/08 Q16 OpenMP http://www.imagemagick.org

Image

edit: im built from srpm on centos x86_64

Re: Transparency bug? or am I doing something wrong?

Posted: 2008-07-09T13:41:26-07:00
by Bonzo
Command prompt, windows XP, version 6.4.0 - I get some white text on a transparent background using your code.

Re: Transparency bug? or am I doing something wrong?

Posted: 2008-07-09T16:03:27-07:00
by fmw42
It works fine for me if you use png for your output --- i get a transparent image with white text. But with gif, it does not work well --- I get a black image with transparent text.

Gif is not that great for transparency. Use PNG. Not sure why it does not work for gif, but png is more consistent


see http://www.imagemagick.org/Usage/formats/#boolean_trans

Re: Transparency bug? or am I doing something wrong?

Posted: 2008-07-09T16:37:37-07:00
by dognose
because it doesn't work in all versions of ie with out a hack.. because png doesn't support animations. gif it is.

This bug doesn't seem to show up in my earlier 6.3.8 version.

Re: Transparency bug? or am I doing something wrong?

Posted: 2008-07-09T17:21:41-07:00
by fmw42
repost a link to this posting on the Bugs forum, then and see what they reply


even the following does not work with gif, now.

convert -size 150x150 xc:black \
-fill "white" -pointsize 50 \
-draw "text 10,125 'text'" -transparent black text.gif

and if one then does

convert text.gif -verbose info:

one gets from the histogram:

2: (239,239,239, 0) #EFEFEF rgba(239,239,239,1)
2: (240,240,240, 0) #F0F0F0 grey94
2: (243,243,243, 0) #F3F3F3 rgba(243,243,243,1)
2: (249,249,249, 0) #F9F9F9 rgba(249,249,249,1)
1: ( 0, 0, 0,255) #00000000 none
1: ( 4, 4, 4, 0) #040404 rgba(4,4,4,1)
1: ( 11, 11, 11, 0) #0B0B0B rgba(11,11,11,1)
1: ( 12, 12, 12, 0) #0C0C0C rgba(12,12,12,1)
1: ( 13, 13, 13, 0) #0D0D0D grey5

I thought the alpha channel was supposed to have values 0 to 1 not 0 to 255

In fact the color values on the left have just the opposite alpha value as on the right for all the histogram values.

According to http://imagemagick.org/script/color.php alpha should be 0 for transparent and 1 for opaque.
"... whereas, alpha values range from 0.0 (fully transparent) to 1.0 (fully opaque)"
Thus all the alpha values on the left side are wrong. They should generally be 1 and the "none" should be 0.

So I would have to think this is a bug (unless I misunderstand something here).

Also note from http://imagemagick.org/script/color.php at the very bottom of the page:

none none rgba( 0, 0, 0, 1.0) #00000000
transparent transparent rgba( 0, 0, 0, 1.0) #00000000

The rgba values for alpha should be 0 not 1. (Documentation error)


Fred