Merge pull request #525 from wiredfool/ico_parser

Make ICO files work with the ImageFile.Parser interface, fixes #522
This commit is contained in:
Alex Clark ☺ 2014-03-17 10:14:03 -04:00
commit 054eb71bc6
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()