It is possible to cut one image to match the silhouette of another.
Only black portions of the right hand side mask (rhs) will allow the left hand side (lhs) to show through. White portions will mask data out. Gray areas filter in direct proportion: thnk of it as black being the foreground and white being the background, just like in a bitmap editor.
icomp 'masked_by( dragon.png , document.png * black )' -o masked_by-dragon-document.png ![]()
The alpha channel also come into play, and is multiplied by the implied alpha channnel (white to black).