Speedups for image contrast scaling
Merge pull request #331 from ChrisBeaumont/image

Image contrast scaling speedups