potential bug converting colors using txt IM 6.4.3-6
Posted: 2008-09-04T15:43:06-07:00
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)
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)