How to cut an image into small (not rectangular shaped) parts?

Basically i want to make a little puzzle game, therefore i need to take an image and cut it into little puzzle parts.
Now the problem is i have no idea how to achieve this and need some hints into the right direction or ultimately a little code example.

First of all thanks for the answers.
When i think about using setMask im running into a difficulty in my brain. I guess its possible to do it with masks, but of course not every puzzle piece should look the same. In order to give them a "random" look (like the "nipple" more to the top or to the bottom of the piece or the hole more left/right etc.) i would need to use alot of different masks while making sure they are still compatible with eachother (to complete the puzzle in the end).

Just use a collection of images for different pieces. You can even write a function to generate the rectangle from the mask up left top and bottom maximum values and divide up your image into the right size bits with appropriate masks. I guess it will be a little more work to figure where each piece snaps into place, but certainly doable.

But I guess the best way to go is to actually randomly generate your puzzle pieces. Start with a square, and depending on its position in the entire puzzle just add 2-4 shapes to each end of the square, and naturally, reuse that same shape's negative for the pieces that are situated next.