[GRASS-SVN] r71486 - grass/branches/releasebranch_7_2/lib/python/imaging

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 12 19:34:11 PDT 2017


Author: annakrat
Date: 2017-09-12 19:34:10 -0700 (Tue, 12 Sep 2017)
New Revision: 71486

Modified:
   grass/branches/releasebranch_7_2/lib/python/imaging/images2gif.py
Log:
pythonlib: improve GIF export with Pillow through quantization (merge from trunk, r71485)

Modified: grass/branches/releasebranch_7_2/lib/python/imaging/images2gif.py
===================================================================
--- grass/branches/releasebranch_7_2/lib/python/imaging/images2gif.py	2017-09-12 17:02:35 UTC (rev 71485)
+++ grass/branches/releasebranch_7_2/lib/python/imaging/images2gif.py	2017-09-13 02:34:10 UTC (rev 71486)
@@ -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