Make ICO files work with the ImageFile.Parser interface, fixes #522

This commit is contained in:
wiredfool 2014-02-16 20:58:06 -08:00
parent cb309c9f59
commit 36323d1140
3 changed files with 11 additions and 0 deletions

View File

@ -222,6 +222,10 @@ class IcoImageFile(ImageFile.ImageFile):
self.mode = im.mode
self.size = im.size
def load_seek(self):
# Flage the ImageFile.Parser so that it just does all the decode at the end.
pass
#
# --------------------------------------------------------------------

BIN
Tests/images/python.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -57,6 +57,13 @@ def test_parser():
# https://github.com/python-imaging/Pillow/issues/78
#assert_exception(IOError, lambda: roundtrip("PDF"))
def test_ico():
with open('Tests/images/python.ico', 'rb') as f:
data = f.read()
p = ImageFile.Parser()
p.feed(data)
assert_equal((48,48), p.image.size)
def test_safeblock():
im1 = lena()