Hacker News new | comments | ask | show | jobs | submit login

PNGs will not scale with pixel count, especially for rendered vector art. The memory footprint will scale though.

As an experiment, I took two vector art files I had, one very simple (a flat icon design) and the other very complex (a texture for a 3d model with lots of drop shadows and non-linear gradients).

The SVGs in question were 6kB and 568kB in size, respectively.

At 25% size (around 256x256px) the PNGs were 13kB and 30kB respectively.

At 100% size (around 1024x1024px) they were 60kB and 266kB respectively.

I scaled the complex image to 200% (2048x2048) just out of curiosity, and it became 841kB, roughly 28x the size of the smallest, which uses 1/64 as many pixels. It is interesting that the complex image seems to approach size growing with area at the high end of resolution. Of course, this is a sample of 2.

I meant, if you need perfect sharpness for the zoomed image, you need to supply bigger PNGs, otherwise they're blurred

Tloewald is saying that if you save vector art at an 8x scale PNG, it will not be 64 times larger. Most pixels in vector art are in contiguous blocks of either solid colors or linear gradients. After prefiltering, both cases reduce to a single value followed by a run of zeroes, which DEFLATE will compress extremely well.

So the only size increase really comes from the edges. In practice, this means that an 8x size increase will often only increase the file size by around 10x.

Modded down for making accurate statements? Awesome.

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