Transparency bug? or am I doing something wrong?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Transparency bug? or am I doing something wrong?

Post 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
Last edited by dognose on 2008-07-09T14:26:11-07:00, edited 1 time in total.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

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

Post by Bonzo »

Command prompt, windows XP, version 6.4.0 - I get some white text on a transparent background using your code.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
Post Reply