diff --git a/Images/lena.ico b/Images/lena.ico new file mode 100644 index 000000000..6fadbe29e Binary files /dev/null and b/Images/lena.ico differ diff --git a/PIL/IcoImagePlugin.py b/PIL/IcoImagePlugin.py index 0068db47f..c484a6774 100644 --- a/PIL/IcoImagePlugin.py +++ b/PIL/IcoImagePlugin.py @@ -49,7 +49,7 @@ class IcoImageFile(BmpImagePlugin.BmpImageFile): raise SyntaxError("not an ICO file") # pick the largest icon in the file - m = "" + m = b"" for i in range(i16(s[4:])): s = self.fp.read(16) if not m: diff --git a/Tests/test_file_ico.py b/Tests/test_file_ico.py new file mode 100644 index 000000000..f741cd663 --- /dev/null +++ b/Tests/test_file_ico.py @@ -0,0 +1,14 @@ +from tester import * + +from PIL import Image + +# sample ppm stream +file = "Images/lena.ico" +data = open(file, "rb").read() + +def test_sanity(): + im = Image.open(file) + im.load() + assert_equal(im.mode, "P") + assert_equal(im.size, (16, 16)) + assert_equal(im.format, "ICO")