mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Merge pull request #4620 from ElinksFr/fix-gbr-image-loading
Fix repeatedly loading .gbr
This commit is contained in:
commit
ac11fa7d1a
|
@ -15,3 +15,11 @@ 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_multiple_load_operations():
|
||||
with Image.open("Tests/images/gbr.gbr") as im:
|
||||
im.load()
|
||||
im.load()
|
||||
with Image.open("Tests/images/gbr.png") as target:
|
||||
assert_image_equal(target, im)
|
||||
|
|
|
@ -84,6 +84,10 @@ class GbrImageFile(ImageFile.ImageFile):
|
|||
self._data_size = width * height * color_depth
|
||||
|
||||
def load(self):
|
||||
if self.im:
|
||||
# Already loaded
|
||||
return
|
||||
|
||||
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