mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 12:17:14 +03:00
Force include colour table for disposal=2 gifs and pad colour table to be valid when flag is set
This commit is contained in:
parent
96c5a4c543
commit
8a36a15ebd
|
@ -476,6 +476,9 @@ def _write_multiple_frames(im, fp, palette):
|
|||
if len(im_frames) > 1:
|
||||
for frame_data in im_frames:
|
||||
im_frame = frame_data['im']
|
||||
if("disposal" in frame_data["encoderinfo"] \
|
||||
and frame_data["encoderinfo"]["disposal"]==2):
|
||||
frame_data['encoderinfo']['include_color_table'] = True
|
||||
if not frame_data['bbox']:
|
||||
# global header
|
||||
for s in _get_global_header(im_frame,
|
||||
|
@ -585,6 +588,8 @@ def _write_local_header(fp, im, offset, flags):
|
|||
include_color_table = im.encoderinfo.get('include_color_table')
|
||||
if include_color_table:
|
||||
palette_bytes = _get_palette_bytes(im)
|
||||
# If needed, expand palette to minimum size
|
||||
while(len(palette_bytes)<9): palette_bytes = palette_bytes*2
|
||||
color_table_size = _get_color_table_size(palette_bytes)
|
||||
if color_table_size:
|
||||
flags = flags | 128 # local color table flag
|
||||
|
|
Loading…
Reference in New Issue
Block a user