I have the name of the album of some kind of musical group. I want to draw it with a mask that will be around the corners of the image. So, I prepared such a mask in gimp:

I use a white mask, but here it is invisible on a white background. So here is the rendering code:
# Draw album image img = cairo.ImageSurface.create_from_png('images/album.png') ctx.set_source_surface(img, posX, posY) ctx.paint()
As you can see, I used OPERATOR_DEST_IN . Brief examples I have found in this page .
But everything disappeared in my program when I installed the layout operator in cairo :( When I comment on this line, everything is fine, but the mask is above my image. What is the right way for this?
ps I am using python2, cairo library
When I delete the layout operator, I see (do not forget that the real mask is white, in this case the album image is dark):

python image composite cairo
Ockonal
source share