[GRASS-SVN] r71485 - grass/trunk/lib/python/imaging

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 12 10:02:35 PDT 2017


Author: annakrat
Date: 2017-09-12 10:02:35 -0700 (Tue, 12 Sep 2017)
New Revision: 71485

Modified:
   grass/trunk/lib/python/imaging/images2gif.py
Log:
pythonlib: improve GIF export with Pillow through quantization

Modified: grass/trunk/lib/python/imaging/images2gif.py
===================================================================
--- grass/trunk/lib/python/imaging/images2gif.py	2017-09-12 16:51:07 UTC (rev 71484)
+++ grass/trunk/lib/python/imaging/images2gif.py	2017-09-12 17:02:35 UTC (rev 71485)
@@ -516,7 +516,10 @@
 
     """
     loop = 0 if repeat else 1
-    images[0].save(filename, save_all=True, append_images=images[1:], loop=loop, duration=duration * 1000)
+    quantized = []
+    for im in images:
+        quantized.append(im.quantize())
+    quantized[0].save(filename, save_all=True, append_images=quantized[1:], loop=loop, duration=duration * 1000)
 
 
 def writeGifVisvis(filename, images, duration=0.1, repeat=True, dither=False,



More information about the grass-commit mailing list