Make resizing & cropping with PIL work

Previously it was trying to use undefined variables so did not work at all.

I did not examine the resizing method, but I note that there seems to be a vertical shift compared to the opencv way.