[Image-SIG] PIL: Image.py: blend function

Scott Hassan hassan@dotfunk.com
Mon, 12 Aug 2002 11:14:32 -0700 (PDT)


Why does the new PIL 1.1.3 blend function limit the range of alpha in
the positive?  When this is limited, you cannot brighten an
Image...only darken it.  Verion 1.1.1 works differently.

I changed the line "elif alpha >= 1.0:" to read "elif alpha == 1.0:"
and everything works now.

Scott


-----------------------------------------------------------------------------

def blend(im1, im2, alpha):
    "Interpolate between images."

    if alpha <= 0.0:
        return im1
    elif alpha >= 1.0:
        return im2
    im1.load()
    im2.load()
    return im1._new(core.blend(im1.im, im2.im, alpha))