Make resizing & cropping with PIL work

Previously it was trying to use undefined variables
Merge pull request #549 from jamt9000/fix-resize-crop-pil

Make resizing & cropping with PIL work