Image scaling causes poor quality in firefox/internet explorer but not chrome

前端 未结 10 1674
一个人的身影
一个人的身影 2020-11-27 03:44

See http://jsfiddle.net/aJ333/1/ in Chrome and then in either Firefox or Internet Explorer. The image is originally 120px, and I\'m scaling down to 28px, but it looks bad pr

相关标签:
10条回答
  • 2020-11-27 04:29

    Seems Chrome downscaling is best but the real question is why use such a massive image on the web if you use show is so massively scaled down? Downloadtimes as seen on the test page above are terrible. Especially for responsive websites a certain amount of scaling makes sense, actually more a scale up than scale down though. But never in such a (sorry pun) scale.

    Seems this is more a theoretical problem which Chrome seems to deal with nicely but actually should not happen and actually should not be used in practice IMHO.

    0 讨论(0)
  • 2020-11-27 04:30

    IE Scaling Depends on Amount of Downsize

    Some people said that an even fraction downsize avoids the problem. I disagree.

    In IE11 I find that reducing an image by 50% (e.g. 300px to 150px) yields a jagged resize (like it's using nearest-neighbor). A resize to ~99% or 73% (e.g. 300px to 276px) yields a smoother image: bilinear or bicubic etc.

    In response I've been using images that are just retina-ish: maybe 25% bigger than would be used on a traditional 1:1 pixel mapping screen, so that IE only resizes a bit and doesn't trigger the ugliness.

    0 讨论(0)
  • 2020-11-27 04:33

    I've seen the same thing in firefox, css transform scaled transparent png's looking very rough.

    I noticed that when they previously had a background color set the quality was much better, so I tried setting an RGBA background with as low an opacity value as possible.

    background:rgba(255,255,255,0.001);
    

    This worked for me, give it a try.

    0 讨论(0)
  • 2020-11-27 04:37

    You should try to maintain a proper aspect ratio between the sizes you're scaling from and to. For example, if your target size is 28px, then your source size should be a power of that, such as 56 (28 x 2) or 112 (28 x 4). This ensures you can scale by 50% or 25% rather than the 0.233333% you're currently using.

    0 讨论(0)
提交回复
热议问题