0

Add --optimize-img={1,2} -- performs postprocessing on images

This adds basic post-processing to images. At the moment, it only
performs actions for the png output type, but changes to work for
jpeg will be exceptionall minimal.
This commit is contained in:
Kyle Brantley
2010-10-09 22:57:20 -06:00
parent 05770468fb
commit bcb423ace4
3 changed files with 45 additions and 8 deletions

View File

@@ -49,6 +49,7 @@ def main():
parser.add_option("--cachedir", dest="cachedir", help="Sets the directory where the Overviewer will save chunk images, which is an intermediate step before the tiles are generated. You must use the same directory each time to gain any benefit from the cache. If not set, this defaults to your world directory.")
parser.add_option("--chunklist", dest="chunklist", help="A file containing, on each line, a path to a chunkfile to update. Instead of scanning the world directory for chunks, it will just use this list. Normal caching rules still apply.")
parser.add_option("--imgformat", dest="imgformat", help="The image output format to use. Currently supported: png(default), jpg. NOTE: png will always be used as the intermediate image format.")
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%")
parser.add_option("-q", "--quiet", dest="quiet", action="count", default=0, help="Print less output. You can specify this option multiple times.")
parser.add_option("-v", "--verbose", dest="verbose", action="count", default=0, help="Print more output. You can specify this option multiple times.")
@@ -98,6 +99,11 @@ def main():
else:
imgformat = 'png'
if options.optimizeimg:
optimizeimg = options.optimizeimg
else:
optimizeimg = None
logging.getLogger().setLevel(
logging.getLogger().level + 10*options.quiet)
logging.getLogger().setLevel(
@@ -111,7 +117,7 @@ def main():
w.go(options.procs)
# Now generate the tiles
q = quadtree.QuadtreeGen(w, destdir, depth=options.zoom, imgformat=imgformat)
q = quadtree.QuadtreeGen(w, destdir, depth=options.zoom, imgformat=imgformat, optimizeimg=optimizeimg)
q.go(options.procs)
def delete_all(worlddir, tiledir):