ImageTools: Correct autoscaling logic

Thanks to Strachu for these corrections.
Merge pull request #1308 from rleigh-dundee/imagetools-fixes

ImageTools: Correct autoscaling logic