3 ms·
Are those SVGs actually smaller than JPEGs included using data URLs?
by IshKebab 9y ago
Are those SVGs actually smaller than JPEGs included using data URLs?
- dmitriid 9y ago> Actually, the code for the SVG with 10 shapes is really small, around 1030 bytes, which goes down to ~640 bytes when passing the output through SVGO. > The images generated with 100 shapes are larger, as expected, weighting ~5kB after SVGO (8kB before). Looking at images that randomly appear on my hard drive: - 1KB PNG image is a tiny image, 45x30 pixels. Just the Base64 part of it's data uri version is 1476 characters in length - A two-color 152x30px PNG image containing simple text and a logo is already 3KB. It's base64 is 3344 characters in length I don't have any small JPEGs though. The smallest I have is a selfie, 960x960 pixels. It's 79KB in size. My guess is that you probably can produce a tiny JPEG/PNG that would beat SVG, but you'd have to play around with a lot of settings for it: reduce quality etc.
- loopdoend 9y agoThe only savings you get from data URLs are from less HTTP/whatever overhead. It’s like embedding the image in the source so everything gets loaded in one request. Base64 is not compression.