potential bug converting colors using txt IM 6.4.3-6

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

potential bug converting colors using txt IM 6.4.3-6

Post by fmw42 »

IM 6.4.3-6 Q16 Mac OSX Tiger

Seems like converting colors using txt when specifying alpha is returning opacity. It would be nice if it could return alpha so that it is consistent with the input specified as rgba, cmyka, hsla and also consistent with results from -fx escape formatting:


However, if that is as intended, let me know for my own use so that I can account for that in retrieving color and transparency values.

Thanks.


Consider the following examples comparing results using fx escapes to those using txt:

Example 1:
convert -size 1x1 xc:"rgba(100%,75%,50%,0.25)" \
-format "rgba(%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)],%[fx:a])" info:
rgba(255,191,127,0.250004)

convert -size 1x1 xc:"rgba(100%,75%,50%,0.25)" -depth 8 txt: | \
sed -n 's/ //g; s/^.*\(rgb[a]*(.*)\).*$/\1/p'
rgba(255,191,127,0.74902)

Example 2:
convert -size 1x1 xc:"hsla(180,100%,50%,0.25)" -colorspace rgb \
-format "rgba(%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)],%[fx:a])" info:
rgba(0,255,255,0.250004)

convert -size 1x1 xc:"hsla(180,100%,50%,0.25)" -colorspace rgb -depth 8 txt: | \
sed -n 's/ //g; s/^.*\(rgb[a]*(.*)\).*$/\1/p'
rgba(0,255,255,0.74902)

Example 3:
convert -size 1x1 xc:"cmyka(100%,100%,0%,50%,0.25)" -colorspace rgb \
-format "rgba(%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)],%[fx:a])" info:
rgba(0,0,127,0.250004)

convert -size 1x1 xc:"cmyka(100%,100%,0%,50%,0.25)" -colorspace rgb -depth 8 txt: | \
sed -n 's/ //g; s/^.*\(rgb[a]*(.*)\).*$/\1/p'
rgba(0,0,127,0.74902)


Example 4:

convert -size 1x1 xc:"#fe9843ca" \
-format "rgba(%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)],%[fx:a])" info:
rgba(254,152,67,0.792157)

convert -size 1x1 xc:"#fe9843ca" -depth 8 txt: | \
sed -n 's/ //g; s/^.*\(rgb[a]*(.*)\).*$/\1/p'
rgba(254,152,67,0.207843)

Also note for example:

convert -size 1x1 xc:"rgba(100%,75%,50%,0.25)" -depth 8 txt:
# ImageMagick pixel enumeration: 1,1,255,rgba
0,0: (255,191,127, 64) #FFBF7F40 rgba(255,191,127,0.74902)

where the value is correctly representing alpha (transparency) on the left side (255,191,127, 64) but is showing opacity on the right side even though it says alpha (as expressed by the a) in rgba(255,191,127,0.74902)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: potential bug converting colors using txt IM 6.4.3-6

Post by magick »

The problem you reported is fixed in the lastest Subversion trunk. Thanks.
Post Reply