[Image-SIG] Problems visualising an RGB24 image
D. Lopez-De-Ipina
dl231@eng.cam.ac.uk
Fri, 18 Feb 2000 10:46:43 +0000 (GMT)
Hi,
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):
data.append(eval(pixelList[iCol]))
im = Image.fromstring("RGB", (320,240), data.tostring())
imageFile.close()
Any help again from the mailing list would be very appreciated.
Thanks,
Diego