Replace lena with hopper

This commit is contained in:
Hugo 2014-09-22 19:00:22 +03:00
parent 9ec58dad82
commit 04d402adae
7 changed files with 11 additions and 10 deletions

BIN
Tests/images/hopper.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
from helper import unittest, PillowTestCase, lena
from helper import unittest, PillowTestCase, hopper
from PIL import Image
@ -23,7 +23,7 @@ class TestFileWebp(PillowTestCase):
def test_read_rgb(self):
file_path = "Tests/images/lena.webp"
file_path = "Tests/images/hopper.webp"
image = Image.open(file_path)
self.assertEqual(image.mode, "RGB")
@ -33,8 +33,8 @@ class TestFileWebp(PillowTestCase):
image.getdata()
# generated with:
# dwebp -ppm ../../Tests/images/lena.webp -o lena_webp_bits.ppm
target = Image.open('Tests/images/lena_webp_bits.ppm')
# dwebp -ppm ../../Tests/images/hopper.webp -o hopper_webp_bits.ppm
target = Image.open('Tests/images/hopper_webp_bits.ppm')
self.assert_image_similar(image, target, 20.0)
def test_write_rgb(self):
@ -45,7 +45,8 @@ class TestFileWebp(PillowTestCase):
temp_file = self.tempfile("temp.webp")
lena("RGB").save(temp_file)
hopper("RGB").save(temp_file)
hopper("RGB").save("temp.webp")
image = Image.open(temp_file)
image.load()
@ -60,17 +61,17 @@ class TestFileWebp(PillowTestCase):
# but it doesn't if the WebP is generated on Ubuntu and tested on
# Fedora.
# generated with: dwebp -ppm temp.webp -o lena_webp_write.ppm
# target = Image.open('Tests/images/lena_webp_write.ppm')
# generated with: dwebp -ppm temp.webp -o hopper_webp_write.ppm
# target = Image.open('Tests/images/hopper_webp_write.ppm')
# self.assert_image_equal(image, target)
# This test asserts that the images are similar. If the average pixel
# difference between the two images is less than the epsilon value,
# then we're going to accept that it's a reasonable lossy version of
# the image. The included lena images for WebP are showing ~16 on
# the image. The old lena images for WebP are showing ~16 on
# Ubuntu, the jpegs are showing ~18.
target = lena("RGB")
self.assert_image_similar(image, target, 20.0)
target = hopper("RGB")
self.assert_image_similar(image, target, 12)
if __name__ == '__main__':