If the image is a jpeg and is bigger than the max size we were given, this code computes the #-moz-samplesize we will use when decoding the image, and adjusts the image size based on that.