fix bug when width or height are not numbers
fix error message formatting
implement crop parameter for cropping images