mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
e534991409
- Change WebPAnimEncoder/Decoder to use RGBX mode instead of RGB (since internally it is using RGBA always)
42 lines
941 B
Python
42 lines
941 B
Python
from helper import unittest, PillowTestCase, hopper
|
|
|
|
from PIL import Image
|
|
|
|
try:
|
|
from PIL import _webp
|
|
except ImportError:
|
|
pass
|
|
# Skip in setUp()
|
|
|
|
|
|
class TestFileWebpLossless(PillowTestCase):
|
|
|
|
def setUp(self):
|
|
try:
|
|
from PIL import _webp
|
|
except:
|
|
self.skipTest('WebP support not installed')
|
|
|
|
if (_webp.WebPDecoderVersion() < 0x0200):
|
|
self.skipTest('lossless not included')
|
|
|
|
def test_write_lossless_rgb(self):
|
|
temp_file = self.tempfile("temp.webp")
|
|
|
|
hopper("RGBX").save(temp_file, lossless=True)
|
|
|
|
image = Image.open(temp_file)
|
|
image.load()
|
|
|
|
self.assertEqual(image.mode, "RGBX")
|
|
self.assertEqual(image.size, (128, 128))
|
|
self.assertEqual(image.format, "WEBP")
|
|
image.load()
|
|
image.getdata()
|
|
|
|
self.assert_image_equal(image, hopper("RGBX"))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|