Image quality when scaling down and high-res sizes are available is lacking
Reported by
tho...@luzat.com,
Jul 14 2016
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.8 Safari/537.36 Example URL: Steps to reproduce the problem: 1. Define an <img> with multiple sizes available, e.g. <img sizes="foo-600.jpg 600w, foo-500.jpg 500w, foo-400.jpg 400w" srcset="100vw" style="width: 100vw"> 2. Vary the viewport size at widths < 400px (and eventually reload the page at that size). What is the expected behavior? Decent image scaling. What went wrong? When Chrome needs to scale down images just a bit, for example at 390px viewport width, the images are noticably losing lots of sharpness. In this example the 400px image would be loaded and scaled down, while in most cases chosing a somewhat larger size (such as 125% of that, that is 500w) would give way better results. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? No Does this work in other browsers? No Current Firefox, Safari and Edge Chrome version: 53.0.2785.8 Channel: dev OS Version: Debian stretch/sid Flash Version: disabled A configurable heuristic which allows to prefer quality over bandwidth (or the other way round; this would be useful, too) when having to scale down images would help. Internally this could change the algorithm to select a source image from: if (scalingDown) chooseSmallestImageLargerThan(width); to: if (highQuality && scalingDown) chooseSmallestImageLargerThan(width * 1.25); or similar. It's obviously always a trade-off between quality and image size. The effect is obviously less noticeable on HiDPI displays. Unfortunately currently no time to produce a complete test case again, but will do if required.
,
Jul 14 2016
,
Jul 14 2016
chrishtr, assigning for comment and re-assignment if action is needed. Where are we on changing how we scaling images and the like? +fmalita@ in the event he has useful insight into what's going on.
,
Jul 14 2016
I have made a simple test case available, but first a NSFW warning: Sorry for the image selection, they may be slightly out of place (but are not too explicit). They are taken straight from a project where the results were problematic in practice. The hackish solution was to drop all small sizes. The example is online at: https://hosted.luzat.com/imgsizes/ The difference is most clearly visible in the details of the lower images, such as texture of the bra, the picture frame and text sharpness. The example does only work well with a DPR of 1.0; with higher densities the larger image will be selected in both cases. I will try to add better demonstrations.
,
Oct 20 2016
Could you please choose a different image? This is NSFW. There are lots of images on the internet that are ok and would demonstrate things. Also, could you please make a simple page that has an image that has bad quality at a reduced scale side-by-side with the same image at "intrinsic" scale?
,
Nov 17 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by dglazkov@chromium.org
, Jul 14 2016Labels: -Type-Bug -Pri-2 Pri-3 Type-Feature