Hi!
This is just something I am trying out. The idea is to get a little familiar with Python and its image processing capabilities before building any application. I am having some doubts on the jpeg compression type. I am using the graphics module.
To start with, I created a (blank) grayscale image and saved it (right away) with the following commands :Code:>>> import graphics
As expected, this gave me a blank image. However, when I check its pixel values, it doesn't give me a single byte, but gives me a triplet (RGB values?)Code:>>> im = graphics.Image.new((200,200),"L") >>> im.save("D:\\blank.jpg", quality=100, bpp=1, compression="no"
I also tried loading the newly created image into another image and checked the pixel values :Code:>>> im.getpixel((23,123)) (255,255,255)
My question is, if the image is a grayscale image, why is the pixel value a triplet, and not a byte? Shouldn't the output for a grayscale image be something along the lines of :Code:>>> bg = graphics.Image.open("D://blank.jpg") >>> bg.getpixel((23,123)) (255,255,255)
ThanksCode:>>> bg.getpixel((23,123)) X (where X is a number between 0 and 255)
Kedar

Reply With Quote

