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

2009-04-11 Thread W. eWatson

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?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet



--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread Diez B. Roggisch

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
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread W. eWatson

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?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread MRAB

W. eWatson wrote:

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?


Have you tried the .tostring() method?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread W. eWatson

MRAB wrote:

W. eWatson wrote:

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?


Have you tried the .tostring() method?
Perfect. Works exactly like I had hoped, 640x480 bytes--nothing more. 
Thanks. I had noticed it, but didn't get the connection. Then I wandered 
around nearby in the PIL description, and noticed something about decoding 
and write. Unknown territory to me. However, if I had followed up there was 
a connection between tostring and raw decoding.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread Diez B. Roggisch

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?


Diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread MRAB

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? :-)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Writing a Raw Image to a File (Win, PIL)

2009-04-11 Thread Diez B. Roggisch

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
--
http://mail.python.org/mailman/listinfo/python-list