2012-10-25 16:57:39 +04:00
|
|
|
from tester import *
|
|
|
|
|
|
|
|
from PIL import Image, TarIO
|
|
|
|
|
2013-04-21 12:04:58 +04:00
|
|
|
codecs = dir(Image.core)
|
|
|
|
if "zip_decoder" not in codecs and "jpeg_decoder" not in codecs:
|
|
|
|
skip("neither jpeg nor zip support not available")
|
|
|
|
|
2012-10-25 16:57:39 +04:00
|
|
|
# sample ppm stream
|
|
|
|
tarfile = "Images/lena.tar"
|
|
|
|
|
|
|
|
def test_sanity():
|
2013-04-21 12:04:58 +04:00
|
|
|
if "zip_decoder" in codecs:
|
|
|
|
tar = TarIO.TarIO(tarfile, 'lena.png')
|
|
|
|
im = Image.open(tar)
|
|
|
|
im.load()
|
|
|
|
assert_equal(im.mode, "RGB")
|
|
|
|
assert_equal(im.size, (128, 128))
|
|
|
|
assert_equal(im.format, "PNG")
|
2012-10-25 16:57:39 +04:00
|
|
|
|
2013-04-21 12:04:58 +04:00
|
|
|
if "jpeg_decoder" in codecs:
|
|
|
|
tar = TarIO.TarIO(tarfile, 'lena.jpg')
|
|
|
|
im = Image.open(tar)
|
|
|
|
im.load()
|
|
|
|
assert_equal(im.mode, "RGB")
|
|
|
|
assert_equal(im.size, (128, 128))
|
|
|
|
assert_equal(im.format, "JPEG")
|
2012-10-25 16:57:39 +04:00
|
|
|
|