diff --git a/optimizeimages.py b/optimizeimages.py index 01799e4..4422feb 100644 --- a/optimizeimages.py +++ b/optimizeimages.py @@ -28,7 +28,7 @@ def check_programs(level): result = filter(lambda x: os.path.exists(os.path.join(x, prog)), path) return len(result) != 0 - for prog,l in [(pngcrush,1), (optipng,2), (advdef,2)]: + for prog,l in [(pngcrush,1), (advdef,2)]: if l <= level: if (not exists_in_path(prog)) and (not exists_in_path(prog + ".exe")): raise Exception("Optimization prog %s for level %d not found!" % (prog, l)) @@ -46,8 +46,7 @@ def optimize_image(imgpath, imgformat, optimizeimg): if optimizeimg >= 2: # 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, + recompress_option = "-z2" if optimizeimg == 2 else "-z4" + subprocess.Popen([advdef, recompress_option,imgpath], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0] diff --git a/overviewer.py b/overviewer.py index e217949..22a103c 100755 --- a/overviewer.py +++ b/overviewer.py @@ -100,7 +100,7 @@ def main(): parser.add_option("--imgformat", dest="imgformat", help="The image output format to use. Currently supported: png(default), jpg.", configFileOnly=True ) parser.add_option("--imgquality", dest="imgquality", default=95, help="Specify the quality of image output when using imgformat=\"jpg\".", type="int", configFileOnly=True) parser.add_option("--bg_color", dest="bg_color", help="Configures the background color for the GoogleMap output. Specify in #RRGGBB format", configFileOnly=True, type="string", default="#1A1A1A") - parser.add_option("--optimize-img", dest="optimizeimg", help="If using png, perform image file size optimizations on the output. Specify 1 for pngcrush, 2 for pngcrush+optipng+advdef. This may double (or more) render times, but will produce up to 30% smaller images. NOTE: requires corresponding programs in $PATH or %PATH%", configFileOnly=True) + parser.add_option("--optimize-img", dest="optimizeimg", help="If using png, perform image file size optimizations on the output. Specify 1 for pngcrush, 2 for pngcrush+advdef and 3 for pngcrush-advdef with more agressive settings. This may double (or more) render times, but will produce up to 30% smaller images. NOTE: requires corresponding programs in $PATH or %PATH%", configFileOnly=True) parser.add_option("--web-assets-hook", dest="web_assets_hook", help="If provided, run this function after the web assets have been copied, but before actual tile rendering begins. It should accept a QuadtreeGen object as its only argument.", action="store", metavar="SCRIPT", type="function", configFileOnly=True) parser.add_option("--web-assets-path", dest="web_assets_path", help="Specifies a non-standard web_assets directory to use. Files here will overwrite the default web assets.", metavar="PATH", type="string", configFileOnly=True) parser.add_option("--textures-path", dest="textures_path", help="Specifies a non-standard textures path, from which terrain.png and other textures are loaded.", metavar="PATH", type="string", configFileOnly=True)