Improved resizing and cropping logic for thumb generation

In certain cases, I was getting generated thumbs with heights ranging from 1 to 12 pixels shorter than the height provided to `.thumb()`.