Added a workaround for images with very large width/height ratios