PIL PNG IOError
Adam Ryan
aryan at CO.LINN.OR.US
Tue Mar 29 14:58:18 PST 2005
Hello to all,
I'm using Python Mapscript, ReportLab and PIL to generate PDF files on
Windows XP. I generate an image using mapscript, save it, and then insert
it into my pdf 'canvas':
Canvas.drawInlineImage(myfile,x,y,w,h)
If my mapfile outputformat is gif, no problem - I get a nice pdf file. But
if my outputformat is png, I get an IOError:
File "C:\python23\lib\site-packages\PIL\ImageFile.py", line 192, in load
IOError: unknown error when reading image file
Your thinking I'm posting to the wrong listserv right? Well, if I take
that png file and open it up in Micro$oft Paint and then save it, my
routine then works without a problem. So I compared the two png files
(before and after saving with Paint) with gdalinfo but got identical
results. I did notice that there was a file size decrease after saving.
But I don't know what else could be different about the files. Any ideas?
Here are two examples of file size reduction with output format:
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE PC256
EXTENSION "png"
END
Reduction: 146kb to 137kb
outputformat
name "png"
driver "GD/PNG"
imagemode "RGB"
mimetype "image/png"
extension "png"
End
Reduction: 272kb to 205kb
Any sugestions would be grand. Cheers to all,
Adam
More information about the MapServer-users
mailing list