Mask between two picture

hi all~
I’m trying to build a labeling tool by wxpython floatCanvas.
In order to show three type of result

1.origin figure
(the left one)
2.the result that paint
(the middle one)
3.the draw result include origin figure and have he draw line above it
but in this step I’ve meet some problem

I tried to use “mask” function to implement, but here is the result:
(the right one)
1.the mask method can only mask one “colour”
2.the result of mask is white, not the color origin

does any one have idea?
thanks for your discussion!

Hi,

you are doing the “mask” almost correctly. So, I think what you want to do is an “overlay”. (am I right?)

Set the masked color (say, black) of the second image and just draw the two images in sequence.

bmp = wx.Bitmap('1.png')
mask = wx.Bitmap('2.png')
mask.SetMaskColour('black')
canvas.AddBitmap(bmp, (0, 0), 'cc')
canvas.AddBitmap(mask, (0, 0), 'cc')
1 Like

have a try at something like GIMP to get a feeling what mask and layer with bitmaps refer to, it’s not easy at first but once you get the hang of it you will soon realize that there must be a lot of computing power even to handle only a few layers with masks (they introduced layer groups to mitigate) :wink:

1 Like

thanks for your detailed explain! :grinning: this helps me a lot

i’m the beginner of image handling, thanks for your recommend! :laughing: