py3k: Add .FLI sanity check, and fix palette bytes bug

This commit is contained in:
Brian Crowell 2012-10-24 08:25:00 -05:00 committed by Brian Crowell
parent 9921d838e4
commit 6765b8e026
3 changed files with 15 additions and 1 deletions

BIN
Images/lena.fli Normal file

Binary file not shown.

View File

@ -81,7 +81,7 @@ class FliImageFile(ImageFile.ImageFile):
self._palette(palette, 0)
palette = [o8(r)+o8(g)+o8(b) for (r,g,b) in palette]
self.palette = ImagePalette.raw("RGB", "".join(palette))
self.palette = ImagePalette.raw("RGB", b"".join(palette))
# set things up to decode first frame
self.frame = -1

14
Tests/test_file_fli.py Normal file
View File

@ -0,0 +1,14 @@
from tester import *
from PIL import Image
# sample ppm stream
file = "Images/lena.fli"
data = open(file, "rb").read()
def test_sanity():
im = Image.open(file)
im.load()
assert_equal(im.mode, "P")
assert_equal(im.size, (128, 128))
assert_equal(im.format, "FLI")