from PIL import Image import json import sys import os import argparse # WARNING do not run this in the 'pano' directly, it will wipe out index.html there. # instead, run it like this: `[.../something]$ python ../gen_cub2.py something.jpg` p = argparse.ArgumentParser (description="generate multires pannellum") p.add_argument ('imagefile', help='image file') p.add_argument ('--title', help='image title', required=True) args = p.parse_args() path = args.imagefile os.system ('python /home/rushing/src/pannellum-2.3.2/utils/multires/generate.py %s' % (path,)) config = json.loads (open ('output/config.json', 'rb').read()) config['multiRes']['path'] = 'output/' + config['multiRes']['path'] config['multiRes']['fallbackPath'] = 'output/' + config['multiRes']['fallbackPath'] config['pitch'] = -20 config['hfov'] = 90 config['autoLoad'] = True config['autoRotate'] = -1 template = """ %s
""" open ('index.html', 'wb').write (template % (args.title, json.dumps (config, sort_keys=True, indent=4)))