N
N
Images

PNG, JPG or SVG: which one to use?

What is the best image format to use on a website?
The choice consists of: PNG, JPG and SVG.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Moskus, 2019-07-01
@n6jWER33E33jSK8s

For photos - JPEG.
For schematic images (icons, diagrams, drawings, graphic primitives) - PNG or SVG. For complex schematic images, PNG can be more beneficial.
Also note that embedding a bitmap in SVG is possible, but pointless.

A
aendnn, 2019-07-01
@aendnn

For svg icons, for photos - jpg, if you need transparency on the photo - png

L
lagudal, 2019-07-01
@lagudal

Different formats for different purposes.
I'll add my opinion to the previous answer.
Let's say background. It can be simple, some kind of abstract, but which cannot be rendered with pure css. For these purposes, svg will also be an ideal choice, since it can be a couple of kilobytes with an unlimited size, while for jpg the same image can be very complex and, with the most ideal option, it can be compressed to a couple of hundred kb.
However, if the same svg background is overflowing with small elements, with a sufficiently large number of dots, then it will not be practical to use such an svg as a background, because even with a weight less than in a jpg of the same size, this svg will visually take a long time to render.
Another point, for chrome it is highly recommended to use webp, which, with the same visual quality, is significantly less in weight than jpg and png. Yes, and google loves it as its format and as a result favors it very much - just run the site through PageSpeed ​​Insights and see what it will recommend there.
If there is no webp on the site, the recommendation will be required)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question