View Full Version : python pil raw data
sidious1741
July 27th, 2009, 04:27 PM
I have found out how to do everything with pil but read raw data. Before I found out about pil I used a module called png to read png files. I could easily get data like '0,12,234,255'. I don't want to edit an image I just want to read the data for each pixel.
unutbu
July 27th, 2009, 09:48 PM
Perhaps what you are looking for is Image.fromstring.
See the PIL handbook (http://www.pythonware.com/library/) for more info.
sidious1741
July 28th, 2009, 04:11 AM
Perhaps what you are looking for is Image.fromstring.
See the PIL handbook (http://www.pythonware.com/library/) for more info.
I don't think so. I want the opposite. I have a bmp file that I want to read, not data that I want to save as a bmp file.
unutbu
July 28th, 2009, 04:55 AM
If you have a bmp file, you should be able to load it with
Image.open('file.bmp')
sidious1741
July 28th, 2009, 04:59 AM
I know that too. I just dont know what to do with the image object.
unutbu
July 28th, 2009, 05:12 AM
This is my last try :)
im=Image.open('file.bmp')
print(list(im.convert().getdata()))
sidious1741
July 29th, 2009, 02:54 AM
This is my last try :)
im=Image.open('file.bmp')
print(list(im.convert().getdata()))
Thanks, that worked.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.