added simple invalid parameter handling to scaleImage