I recommend using a SVG background-image
in your CSS. You can also scale it to fit your display proportions using background-size
doc. Also, remember to set your img
's size (with CSS or HTML attributes), rather than letting it use the size of the image.
First, you need a background svg. You can use the simple background-image: url(x.svg)
syntax, or consider using a data-url. There's a free tool for encoding them.
Next, you'll want to set the size of your background. If your image viewer has a distinct aspect ratio, make your svg the same proportions. Then, tell it to fill either vertically or horizontally. It shouldn't matter, but in the case of a fluke, I find vertical more reliable.
background-size: auto 100%; /* Vertical (full height) */
background-size: 100%; /* Horizontal (full width) */
Now while your image is loading, the background-image
will show instead. Once it's loaded; it'll cover the background (assuming fully opaque).