View Single Post
Old 03-20-2013, 10:55 AM   #11
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 328
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by kovidgoyal View Post
I've been thinking about this patch a bit, currently if an output profile is specified it both scales to the output profile size and lowers the image quality. Is that really necessary? Wouldn't a better algorithm be

1) Scale to the output profile size
2) Lower the image quality only enough to ensure that the image size is < original_area/factor rather than scaled_area/factor
The issue is when rescaling the image, you have to pick a compression factor (because rescaling involves decompressing, rescaling, then compressing). So what I did was rescale to quality 95 and then compress. If we could figure out what the image's original compression setting is we could rescale directly to that level then decide whether to compress further.

Not knowing the original factor, and recognizing that jpeg is lossy, I figured compressing as little as possible while meeting the goal would be the best approach.

Also, I picked a size factor that would yield a combination of reasonable quality and image size relative to image dimensions, and in my testing this is achieved (for 7" readers and tablets) with w*h/16. Therefore it wouldn't make sense to compress an image to original_area/factor if it has been rescaled because we want to acknowledge the rescaled size in setting the threshold. We would only use original_area/factor if we didn't rescale the image.
nickredding is offline   Reply With Quote