From 5cd1b9f01e2dae4105b7e357055d03d0bd1c671b Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Thu, 23 May 2013 14:31:48 +0200 Subject: [PATCH] minor addition --- PIL/GifImagePlugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PIL/GifImagePlugin.py b/PIL/GifImagePlugin.py index 2f420dae3..7c9322754 100644 --- a/PIL/GifImagePlugin.py +++ b/PIL/GifImagePlugin.py @@ -355,7 +355,7 @@ def getheader(im, palette=None, info=None): # create the global palette if im.mode == "P": # colour palette - if countUsedPaletteColors > 0: + if countUsedPaletteColors > 0 and countUsedPaletteColors < 256: paletteBytes = b""; # pick only the used colors from the palette for i in usedPaletteColors: @@ -364,7 +364,7 @@ def getheader(im, palette=None, info=None): paletteBytes = im.im.getpalette("RGB")[:768] else: # greyscale - if countUsedPaletteColors > 0: + if countUsedPaletteColors > 0 and countUsedPaletteColors < 256: paletteBytes = b""; # add only the used grayscales to the palette for i in usedPaletteColors: @@ -391,7 +391,7 @@ def getheader(im, palette=None, info=None): # end of screen descriptor header # add the missing amount of bytes - # the palette can only be 2< 0: paletteBytes += o8(0) * 3 * actualTargetSizeDiff