Is there a binary SVG type?

It just seems to me that when writing code to visualize dynamic data, I repeat the same things over and over in different languages ​​/ platforms. Now, if I had a cross-platform language (which I am doing) and something like a binary version of SVG, I could make my target code the same and use / create interpreters for any platform in which I now need it use.

The reason I don't want SVG is because part of the plaintext is doing it too slowly for my purposes. Of course, I could create my own intermediary format, but if there is something already there that is implemented by different things, the less it works for me!

+8
svg graphics intermediate-language
source share
1 answer

Depending on what you mean by β€œtoo slow,” the answer changes:

File size is too large

Officially, the closest SVG SVG code is SVGZ, which is a gzipped SVG file with the extension .svgz . All relevant SVG viewers should be able to open it. Creating one of the simple * nix systems:

 gzip yourfile.svg && mv yourfile.svg.gz yourfile.svgz 

You can also try Brotli compression , which tends to have smaller file sizes due to longer compression time.

Inclusion of other assets is ineffective

SVG can only link bitmaps and other binary data using base64 encoding , which has a fair amount of overhead.

PDF can include "streams" of raw binary data and is surprisingly efficient at programmatic creation.

Parsing text data takes too long

It's complicated. PDF and his brother Encapsulated PostScript are also old, well-supported vector graphics formats. Unfortunately, they are also text in their core, with additional compression.

You can try Computer Graphics Metafiles , which can be compiled ahead of time. But I'm not sure how well they are supported through consumer devices.

+1
source share

All Articles