[Image-SIG] Semi-transparent - gray "border"

Szymon Kosok szymon at mwg.pl
Fri Jun 19 11:48:49 CEST 2009


I had problem a quite some time ago - resolved here, on mailing list. An
avatar system worked well until then... I don't know why, I haven't changed
anything in code... haven't upgraded PIL... all semi-transparent elements
have gray "border", just like that:


And here is correct version:


And here is code:

def sklejanie(wartstwy, plec, skora):
    import os, Image, ImageChops
    from settings import MEDIA_ROOT, MEDIA_URL

    lalka = Image.open(MEDIA_ROOT + "img/ciala/%s%s.png" % (plec, skora))
    alfa = lalka.split()[-1]
    for p in wartstwy:
        czesc = Image.open(p.element.binaria.path)
        lalka.paste(czesc, (p.x, p.y), czesc)

        czesc = ImageChops.offset(czesc, p.x, p.y)
        alfa = ImageChops.lighter(alfa, czesc.split()[-1])
    return lalka

As I've said... it worked for a long time. What can be wrong?

Best regards,
View this message in context: http://www.nabble.com/Semi-transparent---gray-%22border%22-tp24108447p24108447.html
Sent from the Python - image-sig mailing list archive at Nabble.com.

More information about the Image-SIG mailing list