Cutting out background from image/canvas using a predefined pattern
<p>I'm not requiring a full answer to this question, just an idea on how to approach it.</p>

<p>Let's say that a user on my site wants to cut out the background from this image:</p>

<p><a href="https://i.stack.imgur.com/wKldG.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/wKldG.jpg" alt="Orange car with background"></a></p>

<p>Normally this would be a job for some magic outline tool, <strong>but this site already carries something that would provide a perfect cutout pattern</strong>, namely this:</p>

<p><a href="https://i.stack.imgur.com/80pVG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/80pVG.png" alt="Red car with no background"></a></p>

<p>As you can see this car will fit perfectly over the top one.</p>

<p><strong>If the user could somehow fit the bottom picture over the top one and cut out everything outside that, it would be a perfect background removal.</strong></p>

<p>How do I go about building something like this? Or are there already software out that does something similar?</p>

<p>The bottom picture could be anything, for examle a completely black model for easier recognition, but I'd think that it would be smarter if it used the outline of the transparent .png image and cut out everything outside it.</p>

<p>(The picture itself doesn't need to be used either if there is some way to extract the important bits of it needed for the cutout, of course).</p>