mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
Valid range for baseline jpeg qtables 0 to 255, fixed issue from using signed char instead of unsigned char. added test
This commit is contained in:
parent
9fa3fb98f3
commit
b38c32ed70
|
@ -640,7 +640,7 @@ def _save(im, fp, filename):
|
||||||
try:
|
try:
|
||||||
if len(table) != 64:
|
if len(table) != 64:
|
||||||
raise
|
raise
|
||||||
table = array.array('b', table)
|
table = array.array('B', table)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise ValueError("Invalid quantization table")
|
raise ValueError("Invalid quantization table")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -314,6 +314,10 @@ class TestFileJpeg(PillowTestCase):
|
||||||
30)
|
30)
|
||||||
self.assert_image_similar(im, self.roundtrip(im, qtables='keep'), 30)
|
self.assert_image_similar(im, self.roundtrip(im, qtables='keep'), 30)
|
||||||
|
|
||||||
|
# valid bounds for baseline qtable
|
||||||
|
bounds_qtable = [int(s) for s in ("255 0 " * 32).split(None)]
|
||||||
|
self.roundtrip(im, qtables=[bounds_qtable])
|
||||||
|
|
||||||
# values from wizard.txt in jpeg9-a src package.
|
# values from wizard.txt in jpeg9-a src package.
|
||||||
standard_l_qtable = [int(s) for s in """
|
standard_l_qtable = [int(s) for s in """
|
||||||
16 11 10 16 24 40 51 61
|
16 11 10 16 24 40 51 61
|
||||||
|
|
Loading…
Reference in New Issue
Block a user