Add support for avatar overlays
This commit is contained in:
@@ -21,7 +21,11 @@ def avatar(request, username, size=64):
|
||||
skinStream = open(os.path.dirname(__file__)+"/static/skin.png")
|
||||
imgStream = StringIO(skinStream.read())
|
||||
img = Image.open(imgStream)
|
||||
img = img.crop((8, 8, 16,16))
|
||||
face = img.crop((8, 8, 16,16))
|
||||
face.load()
|
||||
overlay = img.crop((40, 8, 48, 16))
|
||||
overlay.load()
|
||||
img = Image.composite(overlay, face, overlay)
|
||||
img = img.resize((size, size), Image.NEAREST)
|
||||
buf = StringIO()
|
||||
img.save(buf, "PNG")
|
||||
|
Reference in New Issue
Block a user