mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
checking results of webp decoding
This commit is contained in:
parent
95353cff15
commit
02931c4956
BIN
Tests/images/lena_webp_bits.ppm
Normal file
BIN
Tests/images/lena_webp_bits.ppm
Normal file
Binary file not shown.
|
@ -2,7 +2,7 @@ from tester import *
|
|||
|
||||
from PIL import Image
|
||||
|
||||
def test_sanity():
|
||||
def test_read():
|
||||
|
||||
file = "Images/lena.webp"
|
||||
im = Image.open(file)
|
||||
|
@ -10,18 +10,29 @@ def test_sanity():
|
|||
assert_equal(im.mode, "RGB")
|
||||
assert_equal(im.size, (128, 128))
|
||||
assert_equal(im.format, "WEBP")
|
||||
assert_no_exception(lambda: im.load())
|
||||
assert_no_exception(lambda: im.getdata())
|
||||
|
||||
orig_bytes = im.tobytes()
|
||||
|
||||
# generated with: dwebp -ppm ../../Images/lena.webp -o lena_webp_bits.ppm
|
||||
target = Image.open('Tests/images/lena_webp_bits.ppm')
|
||||
assert_image_equal(im, target)
|
||||
|
||||
|
||||
def test_write():
|
||||
file = tempfile("temp.webp")
|
||||
|
||||
lena("RGB").save(file)
|
||||
|
||||
im = Image.open(file)
|
||||
im.load()
|
||||
reloaded= Image.open(file)
|
||||
reloaded.load()
|
||||
|
||||
assert_equal(im.mode, "RGB")
|
||||
assert_equal(im.size, (128, 128))
|
||||
assert_equal(im.format, "WEBP")
|
||||
assert_equal(reloaded.mode, "RGB")
|
||||
assert_equal(reloaded.size, (128, 128))
|
||||
assert_equal(reloaded.format, "WEBP")
|
||||
assert_no_exception(lambda: reloaded.load())
|
||||
assert_no_exception(lambda: reloaded.getdata())
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user