mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
fix reading from empty buffer when loading .gbr
This commit is contained in:
parent
a28b2ea11c
commit
15ae39674e
|
@ -15,3 +15,10 @@ def test_gbr_file():
|
|||
with Image.open("Tests/images/gbr.gbr") as im:
|
||||
with Image.open("Tests/images/gbr.png") as target:
|
||||
assert_image_equal(target, im)
|
||||
|
||||
|
||||
def test_multiples_operation():
|
||||
with Image.open("Tests/images/gbr.gbr") as im:
|
||||
rect = (0, 0, 10, 10)
|
||||
im.crop(rect)
|
||||
im.crop(rect)
|
||||
|
|
|
@ -84,8 +84,9 @@ class GbrImageFile(ImageFile.ImageFile):
|
|||
self._data_size = width * height * color_depth
|
||||
|
||||
def load(self):
|
||||
self.im = Image.core.new(self.mode, self.size)
|
||||
self.frombytes(self.fp.read(self._data_size))
|
||||
if not self.im:
|
||||
self.im = Image.core.new(self.mode, self.size)
|
||||
self.frombytes(self.fp.read(self._data_size))
|
||||
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue
Block a user