[Image-SIG] Problems visualising an RGB24 image
Fri, 18 Feb 2000 09:10:43 -0800
The first thing I see is that you don't seem to be creating a list of RGB values,
just a list of (320x240) values. You need three values for each pixel to create an
RGB image, listed as [R,G,B,R,G,B,R,G,B...], totaling (320x240x3) numbers.
>>> "D. Lopez-De-Ipina" <firstname.lastname@example.org> 02/18/00 02:46AM >>>
Today, I am experimenting a similar a problem to the one yesterday I had
trying to visualise a greyscale image pixel values stored in a file into a
PIL image. I solved yesterday's one, however now I don't know what I might
have done wrong again.
The file I read contains integer numbers in the range (0 to 2^24-1)
representing the RGB24 pixel values of the image. After the code is
executed and the image generated is displayed, it looks distorted. I am
pretty sure the values of the pixels are correct. Here is the code used:
# Visualise colour image
imageFile = open(filename)
data = array.array("i")
for iRow in range(240):
pixelList = string.split(imageFile.readline())
for iCol in range(320):
im = Image.fromstring("RGB", (320,240), data.tostring())
Any help again from the mailing list would be very appreciated.
Image-SIG maillist - Image-SIG@python.org