Hacker News new | ask | show | jobs
by catlifeonmars 7 days ago
Let me make a more rigorous claim: For any image, there is always a vector encoding that is at least as small as the smallest possible raster encoding. The converse is not true.
1 comments

For a single black pixel, you can encode a raster in 1 byte (for the color). How will you encode that in 1 byte with a vector encoding? Seems to me that you’ll need to specify the color (1 byte) and some coordinates (more).
You can trivially transform any raster encoding into a vector one by adding 1 bit that means "decode the rest of this file as raster".

It's technically not just as efficient but the difference is constant and the smallest possible one. And the majority of images that are more efficient as vectors will compensate for it.

Fine, but that’s not a vector encoding. I just don’t think it’s true that vector encoding is better for most images. In particular, for any photograph.
You could do it with less than 1 byte (even assuming color). For example: if the first bit is zero, assume it is a black 1x1 pixel, otherwise, interpret the byte as the width of the image, etcetera ;)
Sure if your encoding includes the image itself, but you can do that with a bitmap encoding too if you want
My point is that the actual size doesn’t matter. You can take any fixed k+O(z) and for a raster image and z_raster >= z_vector holds. You can arbitrarily get k down to zero e.g by techniques mentioned here and you end up with the big O term being all that matters
I was just describing a bitmap encoding.