I want to divide an image into random sized parts. I need this for some kind of puzzle game I'm writing with a friend. Dividing an image into even sized parts like this:
is not a problem at all. But how could I divide in into randomsized parts like this:
The algorithm I'm searching must be capeable of slicing any image in a variable amount (which is set by the player) of parts. The resulting images (parts) should not be smaller than X pixels and not larger than Y Pixels. The parts may not overlap each other. I have no idea how to do this.