Image without quality - Safari

Asked

Viewed 317 times

0

Image of the logo of the site where I am developing loses quality when I open the site in Safari.

Someone’s been there and they know how to fix it?

  • Define "losing quality". Maybe it helps to put an example image here - make some image with the same dimensions (and in the case of a format that is not Ossless, with the same quality) and post here, if you do not want to identify your client’s logo.

  • In short, it gets twisted, serrated...

1 answer

1


It’s not Safari, it’s just macs computers most modern are using retinal screen or retinal screen, the images are a little blurred usually if used in backgrounds, two solutions are:

  1. Image with double size:

    For example, suppose you want to create an image with 442px x 116px, then you create it twice the size (885px x 233px) and uses background-size to halve:

    .logo, .logo-original {
        background: url(https://i.stack.imgur.com/AXDKB.png) no-repeat;
    }
    
    .logo {
        background-size: 442px 116px;
        width: 442px;
        height: 116px;
    }
    
    .logo-original {
        width: 885px;
        height: 233px;
    }
    <div class="logo"></div>
    <hr>
    <div class="logo-original"></div>

    Use <img> can try using width="", thus:

    <img src="https://i.stack.imgur.com/AXDKB.png" width="442">

  2. Use SVG:

    The SVG is a vector image, can be resized without loss of quality (although in some cases the image may seem to have a blurred effect when very small, but depends on the design):

    .logo, .logo-original {
        background: url(https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.svg?v=2bb144720a66) no-repeat;
    }
    
    .logo {
        background-size: 442px 116px;
        width: 442px;
        height: 116px;
    }
    
    .logo-original {
        width: 885px;
        height: 233px;
    }
    <div class="logo"></div>
    <hr>
    <div class="logo-original"></div>

  • Oh yeah, I got it. What I’m doing is exactly this scheme of using a much larger image and decreasing in code, but actually it’s being put as img in html, not as background in css. I am developing in Wordpress, and using the default theme of the company I work, ie, the place to put the logo is already predefined and does not accept SVG.

  • @Peterroberto Just apply with <img src="image-600px_400px.png" width="300" height="200">, of course being non-vector images may not work well, anyway if Wordpress does not allow using SVG then have nothing to do unfortunately.

  • 1

    Yes, yes, thank you very much brother!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.