IconVG is a compact, binary format for simple vector graphics
github.com
github.com
0: 500 Byte Images: The Haiku Vector Icon Format http://blog.leahhanson.us/post/recursecenter2016/haiku_icons...
Here is an article from 2006 about HVIF: https://www.haiku-os.org/news/2006-11-06_icon_facts/
The Haiku Vector Icon Format is pretty close. Unfortunately, I didn't
find a written specification, only a single C implementation, tightly
coupled, as far as I could tell, to the Haiku operating system. Also,
https://www.haiku-os.org/articles/2009-09-14_why_haiku_vector_icons_are_so_small
says that "you wouldn't really want to use HVIF to store generic
vector graphics".
From 2016 post introducing IconVG https://groups.google.com/g/golang-nuts/c/LciLeI5p8k8/m/vSid...:In any way I find the author's statement that, because HVIF claims "you wouldn't really want to use HVIF to store generic vector graphics", then HVIF should not be considered as an alternative.
Precisely HVIF excels as a "compact, binary format for simple vector graphics" and that is exactly what they mean when they say that it should not be used for generic vector graphics. So I could claim this is just reinventing the wheel...
However, SVG Native [1] seems to be very similar, and it's also a subset of SVG, and non-binary.
"SVG Native is a standalone file type, expected to be rendered with a dedicated-purpose renderer. Therefore, SVG Native content must not be present as part of a larger XML (or HTML) document. If it is present as part of a larger XML (or HTML) document, the content should be interpreted as SVG proper."
So in other words, no SVG native in the browser.
Edit- found this: "If a Web author desires to use SVG Native on the Web, the img element may be used instead"
- Only 8-bit RGB, baked in at every level of the spec
- Only two levels of detail per file
- Uses some weird encoding scheme to stuff gradients into the invalid states of pre-multiplied alpha
- Completely ad-hoc encoding
There are multiple levels of detail per file. Each LoD is specified by two numbers: a lower and upper bound on the height-in-pixels that enables the subsequent drawings.
> cowbell.png is 18555 bytes (256 × 256 pixels)
> cowbell.svg is 4506 bytes
> cowbell.ivg is 1017 bytes
They did not use a gzipped version of the svg file which would be a more fair comparison. Someone else in this thread actually compared with a gzipped version of the svg file and claimed the savings were still 2x.I suspect the savings from using IconVG over gzipped svg would be decreased as the size of the source file increased. Though that would need verification.
If we assume the size benefits aren’t significant, I think this is really only valuable for implementing vector graphics presentation on small / embedded systems, given these leaves out a lot of svg features.
It may also be the case that existing svg renderers have suffered from code bloat and aren’t very embeddable. I suspect that a well written and small svg implementation may negate many of the reasons for IconVG’s existence.
917 cowbell.ivg.gz
1017 cowbell.ivg
2217 cowbell.svg.gz
4506 cowbell.svg
18223 cowbell.png.gz
18555 cowbell.png 1863 cowbell.svg.brhttps://jakearchibald.github.io/svgomg/
I play with the settings when I care about SVG size. I don't know what real developers do, but I got a skewed version of cowbell.svg down to about 937 bytes.
It would be nice to see size and performance comparisons between IconVG, SVG native (gzipped), Haiku vector images and AVD binary format.
- https://groups.google.com/g/golang-nuts/c/LciLeI5p8k8 - https://news.ycombinator.com/item?id=14161688
Considering an svg takes a very little space compared to the rest of a project, this won't make a big difference on size.
Also, an svgz can be streamed decompressed at the same time it is parsed, so it is not too much of a complexity, processor time or memory even for the cheapest cellphones.
I really wonder what is the use case for this format.
It's still a work-in-progress and I'm actually considering some major file format changes in the coming weeks. As some of you have noticed, the docs aren't complete. I wasn't expecting to hit Hacker News today.
The primary goals are simplicity and security. The file size benefits are a bonus.
Why not .svg.gz? Well, if that (or another format) works for you, that's great. But implementing SVG needs a lot of code (the SVG spec is 400 pages long) plus dependencies like XML, JavaScript and Freetype/Harfbuzz (or equivalent) libraries. It's practically impossible to do a thorough security audit over a complete implementation.
For example, https://github.com/flutter/flutter/issues/1831 says "We don't want full SVG support. There is too much in the spec that is expensive, heavyweight, and/or duplicates what we already have in Flutter."
What I don't understand is what "relative cubeTo" does. The "documentation" doesn't help, it just points at source code, and explains nothing
https://pkg.go.dev/golang.org/x/exp/shiny/iconvg#Encoder.Rel...
I missed a decade of software development, so maybe it's just me. It seems that nobody actually documents things anymore, but rather expects you to read the source code and guess.
So, that function uses opcode "c", which is documented here in SVG
https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierComm...
Now it makes sense... but that took help from the internet and a lot of time to figure out.
Is it just me, or has actual documentation been abandoned in the last 20 years?
[Edit] I accept it's not a commercial production, but if you want to drive adoption of a proposed new thing, proper documentation would greatly help.
HTML/CSS/JS: prefer brotli, then gzip, then identity (no compression), using the Accept-Encoding header.
Pictures: convert them all to AVIF and WEBP. Keep JPEG around as well for backward compatibility
Other bitmap/non-scalable images: I guess still use PNG unless I missed something
And now SVG, used to be compressible with brotli but soon we'll have to export it to IconVG.
What's next, changing the transport to UDP? Hah!
Oh wait...
IconVG seems to at least support gradients, based on what https://github.com/google/iconvg/blob/main/spec/iconvg-spec.... says.
Incidentally, Microsoft have some other vector formats like WMF/EMF. I assume those are also more efficient than SVG?
> This is not an official Google product, it is just code that happens to be owned by Google.
Is the code developed by an external group and google just happened to be where first prototype was developed?
Fireworks from the early 2000s did a great job helping with optimizing images. These days no one even thinks about it. Tools like Sketch will export SVGs but embed base64 encoded data URLs of 600dpi PNGs in them. Unobservant devs don't realize this is happening which lead to SVGs that are tens of megabytes. Sketch should know better than to do something so ridiculous without any sort of indication or warning. It's shocking how few professional design tools have working or optimal image optimization. I can drop PNGs from any app into free tools that shrink them down losslessly by 50%.
Flash did binary vector art in late 90s and we still haven't caught up to that in 2021. SVGs are still much larger than their SWF counterpart, and only in very few circumstances is any of SVGs functionality superiority relevant.
There's a big void around non-technical designers and untrained, unskilled FE devs that don't know about these problems or solutions. Is the solution yet-another binary vector format that is dead-on-arrival from google? No. But I like that there's some attention to this problem.
Compressing numerical data is done with lossy compression such as DCT.
Why not do that with HTML?