﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33240	get_image_dimensions: ValueError: buffer is not large enough	NKSM	nobody	"When I try to get the dimensions of the image like below: 
{{{
def clean_image(self):
   image = self.cleaned_data.get(""image"")
   if not image:
       raise forms.ValidationError(""No image!"")
   else:
       w, h = get_image_dimensions(image)
       if w != 100:
           raise forms.ValidationError(""The image is %i pixel wide. It's supposed to be 100px"" % w)
       if h != 200:
           raise forms.ValidationError(""The image is %i pixel high. It's supposed to be 200px"" % h)
   return image
}}}

I get :  `ValueError: buffer is not large enough`

**Error at line**: https://github.com/django/django/blob/073b7b5915fdfb89a144e81173176ee13ff92a25/django/core/files/images.py#L62


{{{
# Most of the time Pillow only needs a small chunk to parse the image
# and get the dimensions, but with some TIFF files Pillow needs to
# parse the whole file.
chunk_size = 1024
while 1:
    data = file.read(chunk_size)
    if not data:
        break
    try:
        p.feed(data) ⬅️ **HERE**
    except zlib.error as e:
}}}

**Exception Location**: `/PIL/Image.py in frombuffer, line 2605`

**This works well**:

{{{
from PIL import Image as PillowImage
width, height = PillowImage.open(image).size
}}}


"	Bug	new	File uploads/storage	2.2	Normal				Unreviewed	0	0	0	0	0	0
