[Image-SIG] PIL: problem reading an MSP image

Ireneusz Szczesniak irek.szczesniak at gmail.com
Thu Sep 24 18:27:09 CEST 2009


Hi,

I want to convert an MSP image to a PNG image, but I get errors when
reading the MSP image.  I'm attaching the gzipped input image 
image.msp that I had to rename to image._msp, because of my mail 
server.  This is the script:

 > #!/usr/bin/python
 >
 > import Image
 > import sys
 >
 > im = Image.open("image.msp")
 > im.save("image.png", "PNG")

This is the error that I get:

 > Traceback (most recent call last):
 >   File "./test.py", line 7, in <module>
 >     im.save("image.png", "PNG")
 >   File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1373,
 > in save
 >     self.load()
 >   File "/usr/lib/python2.5/site-packages/PIL/ImageFile.py", line
 > 192, in load
 >     raise IOError("image file is truncated (%d bytes not processed)"
 >  % len(b))
 > IOError: image file is truncated (0 bytes not processed)

When I call the verify method right after the open method, I get this:

 > Traceback (most recent call last):
 >   File "./test.py", line 8, in <module>
 >     im.save("image.png", "PNG")
 >   File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1373,
 > in save
 >     self.load()
 >   File "/usr/lib/python2.5/site-packages/PIL/ImageFile.py", line
 > 161, in load
 >     read = self.fp.read
 > AttributeError: 'NoneType' object has no attribute 'read'

I'm using Python 2.5.2 on Ubuntu 8.04.


Thanks & best,
Irek

-- 
Ireneusz (Irek) Szczesniak
http://www.irkos.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image._msp.gz
Type: application/x-gzip
Size: 4221 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090924/8cf78bc7/attachment.bin>


More information about the Image-SIG mailing list