[Image-SIG] tostring raw/RGB bitmap problem

John Lockwood jal@cinesite.co.uk
Fri, 06 Sep 2002 16:30:14 +0100


Joe,

I'm curious about this as well.
Which file formats are you having trouble with, tiffs are sometimes a problem
in older versions of shake.
Are you sure that the shake fileout image is 8bit ?
Do you get similar errors tying to read the same formats from other programs
like photoshop or gimp?


>
>
> Subject: [Image-SIG] tostring raw/RGB bitmap problem
> Date: Wed, 04 Sep 2002 16:31:05 +0100
> From: Joe Connellan <joec@mill.co.uk>
> To: image-sig@python.org
>
> I'm able to read in some BMP images using the following code
>
> img = Image.open("blah.bmp")
> img.tostring("raw", "RGB", 0, -1)
>
> but on some other images - written by a different application (Shake
> from Nothing Real) I get the following error
>
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "C:\Python22\lib\lib-tk\Tkinter.py", line 1292, in __call__
>     return apply(self.func, args)
>   File "C:\dev\imageViewer\imageViewer.py", line 392, in loadCB
>     self.importClip(fileList)
>   File "C:\dev\imageViewer\imageViewer.py", line 272, in importClip
>     self.imgData.append(img.tostring("raw", "RGB", 0, -1))
>   File "C:\Python22\PIL\Image.py", line 354, in tostring
>     e = _getencoder(self.mode, encoder_name, args)
>   File "C:\Python22\PIL\Image.py", line 257, in _getencoder
>     return apply(encoder, (mode,) + args + extra)
> SystemError: unknown raw mode
>
> how could it understand "RGB" as the raw mode for some bitmaps but not
> others?
>
> Has anyone come accross this before? any ideas on how I go about fixing
> it?
>
> Thanks
>
> Joe