Problem opening sunraster files 8bpp gray

Create issue
Issue #15 new
Matthieu Walraet created an issue

I've an error opening a gray sunrasterfile, with this code:

{{{ #!python

from PIL import Image graysun ="grey.ras") d = graysun.load() }}}

I get: {{{ File "C:\Python27\lib\site-packages\PIL\", line 148, in load self.mode, self.size, a[1], a[2] IndexError: tuple index out of range }}}

I found a way to patch "" to correct this issue, line 77 I have replaced:

        self.tile = [("raw", (0,0)+self.size, offset, (rawmode, stride))]


        self.tile = [("raw", (0,0)+self.size, offset, (rawmode, stride, 1))]

The third item of tupple correspond to orientation.

According to << When used in a tile descriptor, the parameter field should look like: (raw mode, stride, orientation) (...) orientation: Whether the first line in the image is the top line on the screen (1), or the bottom line (-1). If omitted, the orientation defaults to 1. >>

Seems like the orientation parameter can't be omitted. I'm not sure if problem should be fixed in to add orientation as I've done, or in to accept missing orientation.

Regards, Matthieu

Comments (0)

  1. Log in to comment