mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
fix gif test, fix gif optimization for palette length < 3
This commit is contained in:
parent
5cd1b9f01e
commit
dad5e86226
|
@ -386,6 +386,7 @@ def getheader(im, palette=None, info=None):
|
|||
# calculate the palette size for the header
|
||||
import math
|
||||
colorTableSize = math.ceil(math.log(len(paletteBytes)//3, 2))-1
|
||||
if colorTableSize < 0: colorTableSize = 0
|
||||
s.append(o8(colorTableSize + 128)) # size of global color table + global color table flag
|
||||
s.append(o8(0) + o8(0)) # background + reserved/aspect
|
||||
# end of screen descriptor header
|
||||
|
|
|
@ -25,4 +25,4 @@ def test_optimize():
|
|||
im.save(file, "GIF", optimize=optimize)
|
||||
return len(file.getvalue())
|
||||
assert_equal(test(0), 800)
|
||||
assert_equal(test(1), 32)
|
||||
assert_equal(test(1), 38)
|
||||
|
|
Loading…
Reference in New Issue
Block a user