[Image-SIG] composition !

Fredrik Lundh fredrik@pythonware.com
Thu, 26 Apr 2001 12:46:26 +0200


Aureli Soria Frisch wrote:

> Now thinking about paste method , maybe someone could answer an e-mail I
> sent some days ago:
>
> >I am using the MacPython 2.0 and the PIL included by default there.
> >When doing:
> >
> >>>> a=Image.new('L',(128,128))
> >>>> a.paste(128,(0,0,9,9))
> >>>> a.save('prova.tif')
> >
> >A black 128x128 image appears, while up to the documentation an 8x8 box of
> >grayvalue 128 should appear at the top left corner (I think).
> >
> >What am I doing wrong?

in theory, nothing.  it works just fine for me, on Windows
with PIL 1.1.1.

in case you cannot update, here's a workaround:

    def paste(image, ink, box):
        size = box[2] - box[0], box[3] - box[1]
        plate = Image.new(image.mode, size, ink)
        image.paste(plate, box)

Cheers /F