Fix occasional error from non-transparent skins

This commit is contained in:
Trever Fischer
2012-04-18 11:42:01 -04:00
parent b2bd346c35
commit bbe35995e0

View File

@@ -25,7 +25,10 @@ def avatar(request, username, size=64):
face.load()
overlay = img.crop((40, 8, 48, 16))
overlay.load()
img = Image.composite(overlay, face, overlay)
try:
img = Image.composite(overlay, face, overlay)
except ValueError, e:
img = face
img = img.resize((size, size), Image.NEAREST)
buf = StringIO()
img.save(buf, "PNG")