Prevented overflow when zooming in very far on large images

Problem description: If you created a large image (e.g. 8000 x 8000) and then zoomed in very far (e.g., 3600%) an overflow would occur within the code.  This resulted in the image being displayed in a 1 pixel high canvas and you could no longer change the zoom.