Actually, I used:
```
    //  For JPG images, a ratio between 2 and 8 will be set to the closest lower 
    //  power of 2. A ratio between 1 and 2 will be set to 2. A ratio bigger
    //  than 8 will be rounded to the closest lower integer.
```