update geo tools

This commit is contained in:
rolux 2011-11-30 15:28:01 +01:00
commit 1b2a7a0eed
3 changed files with 265 additions and 91 deletions

View file

@ -22,7 +22,7 @@ for file in os.listdir(svg_path):
image = image.resize((size, size), Image.ANTIALIAS)
image.save(png_file.replace('/4096/', '/%d/' % size))
if sys.argv[-1] == '-png':
if sys.argv[-1] != '-nopng':
for file in os.listdir('../png/flags/'):
if file[-4:] == '.png':
country = file[:-4]
@ -31,15 +31,16 @@ if sys.argv[-1] == '-png':
image = Image.open(png_file)
# include 4096 to overwrite manually generated image
for size in [4096, 1024, 256, 64, 16]:
image = image.resize((size, size), Image.ANTIALIAS)
if size < 4096:
image = image.resize((size, size), Image.ANTIALIAS)
image.save(png_file.replace('/4096/', '/%d/' % size))
image = Image.new('RGB', (1152,1152))
image = Image.new('RGB', (1216, 1216))
f = open('../json/countries.json')
countries = json.loads(f.read())
f.close()
for i, country in enumerate(countries):
file = png_path.replace('/4096/', '/64/') + country['code'] + '.png'
if os.path.exists(file):
image.paste(Image.open(file), (i % 18 * 64, int(i / 18) * 64))
image.paste(Image.open(file), (i % 19 * 64, int(i / 19) * 64))
image.save('../png/icons.png')