buffer is not large enough

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

buffer is not large enough

Ed Summers
I was wondering if anyone has seen the "buffer is not large enough"
error before. I'm attempting to read in a TIF and write out a JPG. Is
it possible that the TIF is corrupted somehow? It seems remarkably
small. If you want to reproduce I've put the TIF file up at
http://inkdroid.org/tmp/x.tif

//Ed

>>> import Image
>>> i = Image.open('x.tif')
>>> i.save('x.jpg')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1406, in save
    self.load()
  File "/usr/lib/python2.7/dist-packages/PIL/ImageFile.py", line 158, in load
    self.map, self.size, d, e, o, a
ValueError: buffer is not large enough
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig
Reply | Threaded
Open this post in threaded view
|

Re: buffer is not large enough

Christoph Gohlke


On 10/18/2011 6:03 PM, Ed Summers wrote:

> I was wondering if anyone has seen the "buffer is not large enough"
> error before. I'm attempting to read in a TIF and write out a JPG. Is
> it possible that the TIF is corrupted somehow? It seems remarkably
> small. If you want to reproduce I've put the TIF file up at
> http://inkdroid.org/tmp/x.tif
>
> //Ed
>
>>>> import Image
>>>> i = Image.open('x.tif')
>>>> i.save('x.jpg')
> Traceback (most recent call last):
>    File "<stdin>", line 1, in<module>
>    File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1406, in save
>      self.load()
>    File "/usr/lib/python2.7/dist-packages/PIL/ImageFile.py", line 158, in load
>      self.map, self.size, d, e, o, a
> ValueError: buffer is not large enough


Looks like a corrupted file. The tags are there but the image data is
missing (strip_offsets and strip_byte_counts are zero):

PAGE 0: 4387 x 3368, uint8, 8 bit, minisblack, raw
* 254 new_subfile_type (1I) 0
* 256 image_width (1H) 3368
* 257 image_length (1H) 4387
* 258 bits_per_sample (1H) 8
* 259 compression (1H) 1
* 262 photometric (1H) 1
* 266 fill_order (1H) 1
* 269 document_name (27s) /llcr/12217/0000100000.tif
* 271 make (7s) Inotec
* 272 model (6s) 412BD
* 273 strip_offsets (1I) 0
* 274 orientation (1H) 1
* 277 samples_per_pixel (1H) 1
* 278 rows_per_strip (1H) 4387
* 279 strip_byte_counts (1I) 0
* 282 x_resolution (2I) (400, 1)
* 283 y_resolution (2I) (400, 1)
* 284 planar_configuration (1H) 1
* 296 resolution_unit (1H) 2
* 305 software (55s) Pixel Translations Inc., PIXTIFF Version 57.5.218.4430
* 306 datetime (20s) 2011:08:29 12:31:02
* 315 artist (29s) Library of Congress; Crowley
* 317 predictor (1H) 1
* 339 sample_format (1H) 1

Christoph
_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig