0

Can you help me please how to get a mask image with a transparent background like this using Canvas?

original image

mask

I tried to use context.globalCompositeOperation = 'xor' and adding 2 images but that's wasn't help me...

Not A Bot
  • 2,474
  • 2
  • 16
  • 33
Dmytro
  • 1
  • Did you read https://stackoverflow.com/questions/18379818/canvas-image-masking-overlapping? – James Jul 26 '23 at 13:45
  • Fill with a `.fillStyle = 'red`, `.fillRect( 0,0,w,h )`, then `globalCompositeOperation = 'source-in'` and you should get the cutout? – somethinghere Jul 26 '23 at 13:53

0 Answers0