[Image-SIG] IOError: image file is truncated, 312 bytes left in buffer

Paul Keeley pkeeley@insci.com
Mon, 25 Nov 2002 09:31:37 -0500


I am using the same file.  If I do 
img = Image.open("original.bmp")
img.save("newfile.tif")

it generates the error.  If I do 
img = Image.open("original.bmp")
img.show()
img.save("newfile.tif")

it does not.

When the conversion is finished the image does seem to be correct.  

Thanks,
Paul


> -----Original Message-----
> From:	Fredrik Lundh [SMTP:fredrik@pythonware.com]
> Sent:	Saturday, November 23, 2002 10:51 AM
> To:	Paul Keeley; image-sig@python.org
> Subject:	Re: [Image-SIG] IOError: image file is truncated, 312 bytes
> left in buffer
> 
> Paul Keeley wrote:
> 
> > I am trying to convert a BMP file to TIF as follows:
> > 
> > img = Image.open(filename.bmp)
> > img.save(filename.tif)
> > 
> > every time it displays the error
> > IOError: image file is truncated, 312 bytes left in buffer
> > 
> > If I insert a img.show() between the two lines then sometimes it works
> and
> > sometimes it does not.
> 
> are you using the same file, or do you mean that it works for some files
> and
> not for others?
> 
> when PIL succeeds, does the output image look right?
> 
> (the "image file is truncated, 312 bytes left in buffer" error message
> means
> that there is 312 bytes left in the input buffer, but that's not enough to
> fill
> an entire row of pixels)
> 
> </F>