Fredrik Lundh is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

effbot / pil-2009-raclette http://effbot.org/zone/pil-index.htm

Work repository for PIL 1.1.7 and beyond. The "default" branch should be fairly solid, the other branches less so. For production use, see the pil-117 repository.

Clone this repository (size: 1.6 MB): HTTPS / SSH
hg clone https://bitbucket.org/effbot/pil-2009-raclette
hg clone ssh://hg@bitbucket.org/effbot/pil-2009-raclette

Issues

#15 Problem opening sunraster files 8bpp gray

Reported by Matthieu Walraet

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

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

I get:

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

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

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

by:

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

The third item of tupple correspond to orientation.

According to http://www.pythonware.com/library/pil/handbook/decoder.htm << 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 SunImagePlugin.py to add orientation as I've done, or in ImageFile.py to accept missing orientation.

Regards, Matthieu

Status: new Responsible: Fredrik Lundh Type: bug Priority: major
Milestone: raclette-final Component: none Version: pil-1.1.7

Attachments

Comments and changes

No comments added for this issue yet.

Add comment / attachment

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?