clipping image to image using canvas
Has anyone here have done clipping an image within an image? I've seen so far about clipping on the canvas but are all regular shapes(rectangle, circle, etc...). It would be nice if some have actually done it. P.S. with fabric.js or just the regular canvas. Sure, you can use compositing to draw a second image only where the first image exists: ctx.drawImage(image1,0,0); // this creates the 'mask' ctx.globalCompositeOperation='source-in'; ctx.drawImage(image2,0,0); // this image only draws inside the mask Illustration: House image drawn first and second Grass image is drawn only where house