最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why is my image in html looks blurry even tho the image resolution is high - Stack Overflow

programmeradmin0浏览0评论

hey guys i was building on of the web app and Image in my webpage looks blurry even if it is high resolution. can you guys help me to fix it?

as you can see here, it looks blurrry.

Here is my code:

#album-cover img{
    position: absolute;
    top: 15px;
}
<img src = {name.imageURL} width = "150" height = "150"/>  

hey guys i was building on of the web app and Image in my webpage looks blurry even if it is high resolution. can you guys help me to fix it?

as you can see here, it looks blurrry.

Here is my code:

#album-cover img{
    position: absolute;
    top: 15px;
}
<img src = {name.imageURL} width = "150" height = "150"/>  

how can i fix this? thank you

Share Improve this question edited Dec 11, 2020 at 9:20 maxime1992 23.8k11 gold badges87 silver badges130 bronze badges asked Dec 11, 2020 at 4:36 DjBillje OfficialDjBillje Official 3862 gold badges4 silver badges18 bronze badges 1
  • Upload image separately, or upload on net, and provide link here. – Deadpool Commented Dec 11, 2020 at 4:38
Add a ment  | 

4 Answers 4

Reset to default 3

What site are you working on? i meant what platform? If you have a high res-image and then resize it using CSS, chances are that it will turn blurry, whereas if you crop it or resize it manually to 150px x 150px and upload it, it will retain its sharpness even if you omit the width and height in css like this:

The problem may e from your styling. You are setting the size of the image 150x150, which may be different from the original ratio. Since the image must be resize to that ratio it could lead to this behavior.

You may either try to use only width or height and let the other property auto calculated, or you can try using max-height or max-width instead. Another solution is that you can resize the image using some library before display it.

Insert this line in your styling for the image. When images are being downscaled (or upscaled), an image rendering algorithm has to be used. The line below specifies this rendering algorithm to one that looks clear.

image-rendering: pixelated;

Check this link out: https://www.w3schools./cssref/css3_pr_image-rendering.asp

set the object-fit property to cover. This will not mess with the resolution of the image.

发布评论

评论列表(0)

  1. 暂无评论