DEV Community


Discussion on: Benefits of SVG

hseritt profile image
Harlin Seritt

"But JPEGs are best for photographs (product catalog, social feed, etc.). SVG should not be used for those kinds of images." -- Why and how come?

Thread Thread
jfbrennan profile image
Jordan Brennan • Edited

Because there are no silver bullets.

SVGs are a vector format, which means the image data is a bunch of geometry stored as text. This makes them great for shapes and logos and even detailed illustrations because that’s what those images are - geometric shapes filled with color.

JPEGs are bitmap, which means they store image data as a map of colors to pixel locations. The kind of detail real life images require is best represented at the pixel level, so JPEG which is a bitmap format with a really good compression algo are best for real life images. Getting the same quality from an SVG, which for some photos may not even be possible, would result in an insanely large file.

Another misconception about SVGs is they’re the best for icons. I don’t think that’s true either: