Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Graph, like a graphic calculator showing f(x).

Like you, I would have thought SVGs would be smaller, but experimentation proved that they weren't. It hadn't be checked before, but new options had to be found around the whole stack!

So instead of the crispy SVG that scaled so well, now there are some custom-sized PNG instead - served by geographically close VPS. It seems very dirty on paper, but in practice it works much better than the previous solution that as I purist I found very cute and clever. Unfortunately, it didn't achieve the goals and had to be discarded.

I find that a funny example that illustrates how full-stack engineering is very real.



If you only display the images at a predefined size, a PNG (designed for that size) will be crisper than an SVG. Discovered this at a previous job where we were doing a rebrand, we were using SVGs for the logo and monograms on the website and the designers complained that they didn't look good. We compared them with equivalent PNGs and the quality was much better.

General guidance:

* Photo - Use JPG, WebP or similar

* Images used at a single predefined size, where quality matters, e.g. logos - Use PNG

* UI graphics that are displayed at integer multiples of the base size, eg 24, 48, 72 - Use SVG

* Illustration graphics - investigate trade-offs between size and quality for both SVG and PNG


Or your SVGs were desined in Illustrator without actually modifying the code so that all of the coordinates in them would be integers.

Had this issue about 5 years ago. Good SVGs need to go through a manual code filtering step.


In this particular case, it wasn’t integer coordinates that were the issue, but the antialiasing quality, browsers (at the time, 3 years ago, might be better now) just couldn’t cut it. Say what you like about Adobe, but their algorithms are top-notch.

On the integer coordinates side of things, if an SVG has horizontal or vertical lines, I’ll always make sure they’re well-aligned before putting them into a UI.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: