Last active
August 29, 2015 14:12
-
-
Save illuzian/54a083c5a394eae00177 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib | |
from PIL import Image | |
import cStringIO | |
map_data = "https://static.mwomercs.com/data/cw/mapdata.json" | |
data = json.load(urllib.urlopen(map_data)) | |
images = {} | |
for x, y in data.iteritems(): | |
if x != 'generated' and int(y['owner']['id']) != 0: | |
img = y['owner']['icon'] | |
if img not in images: | |
images[img] = Image.open(cStringIO.StringIO(urllib.urlopen(img).read())).resize((20,20)) | |
map = Image.new("RGB", (1400,1400)) | |
for x, y in data.iteritems(): | |
if x != 'generated' and int(y['owner']['id']) != 0: | |
map.paste(images[y['owner']['icon']], ((int(y['position']['x'])+700), (-int(y['position']['y'])+700)) ) | |
map.save('test.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment