```Also in your patch, if mozSampleSize didn't work, we were starting again with ratio = 2, which was likely useless. My change fixes this too.```

Maybe we should need info platform devs about the possibility  that moz SampleSize failed to work. If there is no chance that platform fail to downsample a normal jpeg image,  I could totally agree with your main idea here.