ImageWidth and ImageHeight were inverted in calculateImage function

Simple Typo. Fixed.