Fixed IndexSizeError in IE when the size of the image exceedes 8192 pixels

Patch for the IndexSizeError IN IE.