Based on https://code.google.com/p/imageclipper/ with enhancements