From e65b77ac579f9e96ccce682725265b25da0a666d Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Thu, 2 Jun 2011 00:57:43 +0200 Subject: [PATCH] Fix optimizeimg=2 transparency issue not messing with the color type in optipng. --- optimizeimages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/optimizeimages.py b/optimizeimages.py index e1699b0..01799e4 100644 --- a/optimizeimages.py +++ b/optimizeimages.py @@ -45,7 +45,8 @@ def optimize_image(imgpath, imgformat, optimizeimg): os.rename(imgpath+".tmp", imgpath) if optimizeimg >= 2: - subprocess.Popen([optipng, imgpath], stderr=subprocess.STDOUT, + # the "-nc" it's needed to no broke the transparency of tiles + subprocess.Popen([optipng, "-nc", imgpath], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0] subprocess.Popen([advdef, "-z4",imgpath], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0]