Wrong pixel values.
Posted: 2012-07-02T16:07:42-07:00
Hello I have an image that is mostly yellow and I tried to turn it into a grayscale image by using this.
and it worked the image turned into grayscale and I saved it as a new file.
I later used that same file but now I need to use the grayscale value of the pixels. The grayscale value is supposed to be any of the RGB colors since they're supposed to be the same. Yet when I use this
I get many 0 values so I printed each pixel RGB and I got different values mainly 1 with PixelGetRed or PixelGetBlue but never the same.
Then I used the image without a grayscale conversion and I got the same. The weird thing is that the image is mostly yellow so I would expect PixelGetRed and PixelGetGreen to return 1 both but I mostly get 1 on Red and 0 elsewhere or 1 on Blue and 0 elsewhere.
Any ideas what might be happening?
Code: Select all
MagickQuantizeImage(image_wand,256,GRAYColorspace,0,MagickFalse,MagickFalse);
I later used that same file but now I need to use the grayscale value of the pixels. The grayscale value is supposed to be any of the RGB colors since they're supposed to be the same. Yet when I use this
Code: Select all
PixelGetRed(pixels_wand[i])
Then I used the image without a grayscale conversion and I got the same. The weird thing is that the image is mostly yellow so I would expect PixelGetRed and PixelGetGreen to return 1 both but I mostly get 1 on Red and 0 elsewhere or 1 on Blue and 0 elsewhere.
Any ideas what might be happening?