TinyVG
Another binary encoded vector graphics format.
Why one other format?
SVG is a horribly complicated format and an overkill for many initiatives. The specification contains manner too many edge instances so implementing a brand new SVG renderer will all the time have drawbacks or lacking items.
TinyVG tries to be less complicated. Fewer options, however highly effective sufficient to cowl 90% of use instances.
Options
- Compact binary encoding (39% measurement of a comparable SVG file on common)
- Cowl 90% of sometimes used SVG options recordsdata whereas solely having a tiny fraction of complexity
- Frequent 2D primitives are supported (paths, strains, rectangles, polygons)
- Linear and radial two-point gradient help.
- Configurable precision for smaller recordsdata.
- Understandable specification
Demo
The tiger is rendered with the present implementation of the TinyVG renderer:
The original SVG is 96,719 bytes massive, whereas the optimized one is 85,806 bytes massive. When transformed to TinyVG, the file shrinks to 27,522 bytes. This implies we solely have 32% measurement of the optimized supply information.
Actual World Knowledge
TinyVG is benchmarked in opposition to an enormous set of check photos from MaterialDesign, Papirus, W3C, Zig and freesvg.org
A brief abstract is that TVG is usually between 20% and 50% of the equal SVG file in measurement and manner simpler to parse or render.
Assets
Specification
The specification is a human-readable, casual description of the format. It ought to allow programmers to create new TinyVG implementations.
There’s additionally a textual illustration that’s described roughly on this doc:
Instance Knowledge
Right here you’ll be able to obtain some TinyVG recordsdata to examine or toy round with:
- Tiger (TVG, TVGT, SVG, PNG, Source)
- Protect Icon (TVG, TVGT, PNG, Source)
- Flowchart (TVG, TVGT, DOT, PNG)
- Folder Icon (TVG, TVGT, SVG, PNG, Source)
- Comedian (TVG, TVGT, SVG, PNG, Source)
- Chart (TVG, TVGT, SVG, PNG)
Tooling
The instruments present a TinyVG renderer in addition to a textual content format converter for TinyVG textual content and SVG.
Native Library
The native library is appropriate for integrating TinyVG into native initiatives. Be it Zig, Rust, C or C++, you need to use this library with any language that helps the C ABI. This additionally contains dotnet by way of P/Invoke and Java by way of JNI. Proper now, solely a C API is offered, wrapping to different languages should be carried out manually right now.
The library offers means to render TinyVG to bitmaps and SVG (textual content).
Polyfill
There’s additionally a polyfill accessible that lets you use TinyVG within the browser:
Contribution
The principle improvement work is finished at GitHub, however be happy to ship a e mail to contact@tinyvg.tech.
There is also a Discord Community for a extra informal and fast interplay, it’s also possible to get assist there!