possible bug [pixel:...] with hsb IM 6.7.1.0 Q16
Posted: 2011-07-27T16:50:27-07:00
IM 6.7.1.0 Q16 Mac OSX Tiger.
I am getting strange results when converting colors such as white, red, etc (primary colors) to hsb and then trying to get the resulting values.
pcolor="white"
This gives strange results:
hsb=`convert xc:$pcolor -colorspace hsb -format "%[pixel:u.p{0,0}]" info:`
echo hsb="$hsb"
hsb=blue
This gives reasonable results:
hue=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.r]" info:`
sat=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.g]" info:`
bri=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.b]" info:`
echo "hsb=hsb($hue%,$sat%,$bri%)"
hsb=hsb(0%,0%,100%)
Similarly:
pcolor="red"
hsb=`convert xc:$pcolor -colorspace hsb -format "%[pixel:u.p{0,0}]" info:`
echo hsb="$hsb"
hsb=cyan
hue=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.r]" info:`
sat=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.g]" info:`
bri=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.b]" info:`
echo "hsb=hsb($hue%,$sat%,$bri%)"
hsb=hsb(0%,100%,100%)
From the above, it seems to take the hsb values and interpret them as if rgb values if it can match those values to a color name (without regard to the colorspace).
However, the following looks fine.
pcolor="gold"
hsb=`convert xc:$pcolor -colorspace hsb -format "%[pixel:u.p{0,0}]" info:`
echo hsb="$hsb"
hsb=hsb(14.052%,100%,100%)
hue=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.r]" info:`
sat=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.g]" info:`
bri=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.b]" info:`
echo "hsb=hsb($hue%,$sat%,$bri%)"
hsb=hsb(14.052%,100%,100%)
So for this color it works fine and returns hsb values.
Thus it seems to only fail when trying to match the result to a color name. So perhaps one should change pixel: so that it only returns percent values and not color names when not using rgb colorspace/color values?
Does that cause other problems?
I am getting strange results when converting colors such as white, red, etc (primary colors) to hsb and then trying to get the resulting values.
pcolor="white"
This gives strange results:
hsb=`convert xc:$pcolor -colorspace hsb -format "%[pixel:u.p{0,0}]" info:`
echo hsb="$hsb"
hsb=blue
This gives reasonable results:
hue=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.r]" info:`
sat=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.g]" info:`
bri=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.b]" info:`
echo "hsb=hsb($hue%,$sat%,$bri%)"
hsb=hsb(0%,0%,100%)
Similarly:
pcolor="red"
hsb=`convert xc:$pcolor -colorspace hsb -format "%[pixel:u.p{0,0}]" info:`
echo hsb="$hsb"
hsb=cyan
hue=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.r]" info:`
sat=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.g]" info:`
bri=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.b]" info:`
echo "hsb=hsb($hue%,$sat%,$bri%)"
hsb=hsb(0%,100%,100%)
From the above, it seems to take the hsb values and interpret them as if rgb values if it can match those values to a color name (without regard to the colorspace).
However, the following looks fine.
pcolor="gold"
hsb=`convert xc:$pcolor -colorspace hsb -format "%[pixel:u.p{0,0}]" info:`
echo hsb="$hsb"
hsb=hsb(14.052%,100%,100%)
hue=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.r]" info:`
sat=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.g]" info:`
bri=`convert xc:$pcolor -colorspace hsb -format "%[fx:100*u.b]" info:`
echo "hsb=hsb($hue%,$sat%,$bri%)"
hsb=hsb(14.052%,100%,100%)
So for this color it works fine and returns hsb values.
Thus it seems to only fail when trying to match the result to a color name. So perhaps one should change pixel: so that it only returns percent values and not color names when not using rgb colorspace/color values?
Does that cause other problems?