slight inconsistency converting alpha in txt: IM 6.4.3-6
Posted: 2008-09-04T16:11:08-07:00
IM 6.4.3-6 Q16 Mac OSX Tiger
This is not critical, but I just wanted to point it out. There seems to be a slight inconsistency in converting alpha values in the range 0-1 to 8-bit values relative how rgb values in range 0-100% are converted to 8-bit values.
For example:
convert -size 1x1 xc:"rgba(100%,75%,50%,0.5)" -depth 8 txt: | \
sed -n 's/ //g; s/^.*[^(]\((.*)\)[^)].*$/\1/p'
(255,191,127,128)
The rgb value of 50% goes to 127, but the alpha value of .5 goes to 128
On the other hand, the following is consistent due to the consistent use of floor()
convert -size 1x1 xc:"rgba(100%,75%,50%,0.5)" \
-format "(%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)],%[fx:floor(255*a)])" info:
(255,191,127,127)
This is not critical, but I just wanted to point it out. There seems to be a slight inconsistency in converting alpha values in the range 0-1 to 8-bit values relative how rgb values in range 0-100% are converted to 8-bit values.
For example:
convert -size 1x1 xc:"rgba(100%,75%,50%,0.5)" -depth 8 txt: | \
sed -n 's/ //g; s/^.*[^(]\((.*)\)[^)].*$/\1/p'
(255,191,127,128)
The rgb value of 50% goes to 127, but the alpha value of .5 goes to 128
On the other hand, the following is consistent due to the consistent use of floor()
convert -size 1x1 xc:"rgba(100%,75%,50%,0.5)" \
-format "(%[fx:floor(255*r)],%[fx:floor(255*g)],%[fx:floor(255*b)],%[fx:floor(255*a)])" info:
(255,191,127,127)