Add JPEG output support.
This commit is contained in:
14
gmap.py
14
gmap.py
@@ -32,8 +32,7 @@ import quadtree
|
||||
|
||||
helptext = """
|
||||
%prog [OPTIONS] <World # / Path to World> <tiles dest dir>
|
||||
%prog -d <World # / Path to World / Path to cache dir> [tiles dest dir]
|
||||
"""
|
||||
%prog -d <World # / Path to World / Path to cache dir> [tiles dest dir]"""
|
||||
|
||||
def main():
|
||||
try:
|
||||
@@ -46,6 +45,7 @@ def main():
|
||||
parser.add_option("-d", "--delete", dest="delete", help="Clear all caches. Next time you render your world, it will have to start completely over again. This is probably not a good idea for large worlds. Use this if you change texture packs and want to re-render everything.", action="store_true")
|
||||
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.")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
@@ -85,12 +85,20 @@ def main():
|
||||
else:
|
||||
chunklist = None
|
||||
|
||||
if options.imgformat:
|
||||
if options.imgformat not in ('jpg','png'):
|
||||
parser.error("Unknown imgformat!")
|
||||
else:
|
||||
imgformat = options.imgformat
|
||||
else:
|
||||
imgformat = 'png'
|
||||
|
||||
# First generate the world's chunk images
|
||||
w = world.WorldRenderer(worlddir, cachedir, chunklist=chunklist)
|
||||
w.go(options.procs)
|
||||
|
||||
# Now generate the tiles
|
||||
q = quadtree.QuadtreeGen(w, destdir, depth=options.zoom)
|
||||
q = quadtree.QuadtreeGen(w, destdir, depth=options.zoom, imgformat=imgformat)
|
||||
q.go(options.procs)
|
||||
|
||||
def delete_all(worlddir, tiledir):
|
||||
|
||||
Reference in New Issue
Block a user