The TwentyTwenty jQuery plugin does this beautifully, but I wanted to avoid external dependencies. Also, I guessed this was going to be relatively straightforward using
drawImage, and for once it turned out I was right.
Try dragging and dropping your own image files in there.
Check out the code: