How to use Imagick to merge and mask images?
I know very little of image processing and even less of the terminology used, so please bear with me.  

Basically, I want to merge two images together where one of them will act as a mask. That image looks something like this:  
![Example][1]  
Where the blue and yellow background are both transparent in reality.

This image is being used as a mask for regular photo's. Parts of the photo that 'stick out' of the circle need to be 'cropped' (be made invisible) while the inside remains visible.  
So everything that comes in the blue area is invisible, everything in the yellow area is visible.

I honestly have no clue how to go about it so any help would be greatly appreciated!

**Edit:**  
I use the API version of Imagick, not the commandline version

  [1]: http://i.stack.imgur.com/aAUCc.png
How to use Imagick to merge and mask images?
===

I know very little of image processing and even less of the terminology used, so please bear with me.  

Basically, I want to merge two images together where one of them will act as a mask. That image looks something like this:  
![Example][1]  
Where the blue and yellow background are both transparent in reality.

This image is being used as a mask for regular photo's. Parts of the photo that 'stick out' of the circle need to be 'cropped' (be made invisible) while the inside remains visible.  
So everything that comes in the blue area is invisible, everything in the yellow area is visible.

I honestly have no clue how to go about it so any help would be greatly appreciated!

**Edit:**  
I use the API version of Imagick, not the commandline version

  [1]: http://i.stack.imgur.com/aAUCc.png