1

TinyVG

 1 year ago
source link: https://tinyvg.tech/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

logo.svg

An alternative binary encoded vector graphics format.

Why another format?

SVG is a horribly complex format and an overkill for most projects. The specification includes way too many edge cases so implementing a new SVG renderer will always have drawbacks or missing pieces.

TinyVG tries to be simpler. Fewer features, but powerful enough to cover 90% of use cases.

Features

  • Compact binary encoding (39% size of a comparable SVG file on average)
  • Cover 90% of typically used SVG features files while only having a tiny fraction of complexity
  • Common 2D primitives are supported (paths, lines, rectangles, polygons)
  • Linear and radial two-point gradient support.
  • Configurable precision for smaller files.
  • Comprehensible specification

The tiger is rendered with the current implementation of the TinyVG renderer:

tiger.png

The original SVG is 96,719 bytes large, while the optimized one is 85,806 bytes large. When converted to TinyVG, the file shrinks to 27,522 bytes. This means we only have 32% size of the optimized source data.

Real World Data

TinyVG is benchmarked against a huge set of test images from MaterialDesign, Papirus, W3C, Zig and freesvg.org

A short summary is that TVG is typically between 20% and 50% of the equivalent SVG file in size and way easier to parse or render.

See the benchmark results

Resources

Specification

The specification is a human-readable, informal description of the format. It should enable programmers to create new TinyVG implementations.

There is also a textual representation that is described roughly in this document:

Example Data

Here you can download some TinyVG files to inspect or toy around with:

Tooling

The tools provide a TinyVG renderer as well as a text format converter for TinyVG text and SVG.

Native Library

The native library is suitable for integrating TinyVG into native projects. Be it Zig, Rust, C or C++, you can use this library with any language that supports the C ABI. This also includes dotnet via P/Invoke and Java via JNI. Right now, only a C API is provided, wrapping to other languages must be done manually at this time.

The library provides means to render TinyVG to bitmaps and SVG (text).

Polyfill

There's also a polyfill available that allows you to use TinyVG in the browser:

Contribution

The main development work is done at GitHub, but feel free to send a email to [email protected].

There also is a Discord Community for a more casual and quick interaction, you can also get help there!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK