gallery icon indicating copy to clipboard operation
gallery copied to clipboard

Limit the scale factor of thumbnails to integers

Open oparoz opened this issue 9 years ago • 4 comments

From @oparoz on September 28, 2015 18:13

Instead of generating exact thumbnails, we could serve ones of a higher resolution.

Per example, users with a screen with a pixel ratio of 2.1 would get thumbnails generated with a ratio of 3.

Pros

  • Higher chance that the thumbnail will be available right away
  • 100% chance if thumbnails are pre-generated

Cons

  • +5-8MB per 100 thumbnails
  • Wait time could be almost the same as it would take less time to generate thumbnails, but longer to download them

@setnes @icewind1991 @demattin @mmattel

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Copied from original issue: owncloud/gallery#392

oparoz avatar Sep 04 '16 12:09 oparoz

From @deMattin on September 28, 2015 20:52

I like any enhancement that makes it possible to pregenerate thumbnails because this is it, that slows anything down if thumbnails have to be generated just in time. Thumbnails are previews and detail quality isn't that much important, I think. But what's about always rounding down (giving smaller thumbnail) and let phone scale picture slightly up? So pregenerating ratio 1, 2 and 3 and always simply throwing modulo away if ratio doesn't fit exactly? So having a pixel ratio screen of 2.1 will then get the thumbnail of ratio 2. If thumbnails looks sufficent this way you could also save some bandwidth in some cases of ratios with modulo. But I haven't read much about this ratio thing and don't know. if this can work or I understand it all right.

Edit: Or what about "kaufmännisches Runden"? So, 2.2 will become 2 and 2.5 and up will get 3?

oparoz avatar Sep 04 '16 12:09 oparoz

I'm against rounding down ;) It usually immediately shows when a picture is stretched. The opposite is also true, images are usually crisper when the browser shrink them, so that could be another con

oparoz avatar Sep 04 '16 12:09 oparoz

From @deMattin on September 28, 2015 21:23

Is it really that bad? I "simulated" browser scaling by simply using chrome browsers scaling feature and for me it's not a problem with the quality. Ok, you will always get a better pic, if you scale from original to fitting scale than if you scale 30% up or down. But is it that important for thumbnails? Let's see, what others think. And how is it possible to show the effect of the different approaches?

oparoz avatar Sep 04 '16 12:09 oparoz

If you load some panoramic pictures, you'll see how blurry they become, but you can also hack the javascript and multiply the scale factor by 0.83.

https://github.com/owncloud/gallery/blob/master/js/thumbnail.js#L108

oparoz avatar Sep 04 '16 12:09 oparoz