Writing a "Raw" Image to a File (Win, PIL)

Diez B. Roggisch deets at nospam.web.de
Sat Apr 11 20:07:38 EDT 2009


MRAB schrieb:
> Diez B. Roggisch wrote:
>> W. eWatson schrieb:
>>> Diez B. Roggisch wrote:
>>>> W. eWatson schrieb:
>>>>> I have an image of described as:
>>>>> Img Info:  {}
>>>>>  size:  (640, 480)
>>>>>  format:  None
>>>>>  mode:  P
>>>>>  palette:  <ImagePalette.ImagePalette instance at 0x02393378>
>>>>>  bands:  ('P',)
>>>>>  type:  <type 'instance'>
>>>>>
>>>>> I'd like to write it to a file. Apparently, I need to convert it to 
>>>>> a string first. How do I do that? Pickle?
>>>>
>>>> Did you bother reading the PIL documentation just for about 30seconds?
>>>>
>>>> http://www.pythonware.com/library/pil/handbook/image.htm
>>>>
>>>> Hint: look for "save".
>>>>
>>>> Diez
>>> So, you are telling me what? To save it as a jpg file, or maybe a bmp 
>>> file? All of them have headers, right?
>>
>> Yes. Where exactly do you say "I don't want headers, I want raw data 
>> dumped to the disk"?
>>
> Erm, in the Subject line? :-)

Darn. Should consider reading them.

Diez



More information about the Python-list mailing list