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

Fredrik Lundh fredrik@pythonware.com
Sat, 23 Nov 2002 16:51:25 +0100


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>