When I read a gray image using the getpixel method, it gives the green component of pixels different from those of red and blue components. Usually all the red, green and blue component of a pixel are the same. The same image when I read in matlab gives the correct result. Can anybody explain why this happens? What is the solution for this?