https://github.com/leso-kn/svg2vd
Convert svg files to Android VectorDrawable (xml) – lean, java-free
https://github.com/leso-kn/svg2vd
android android-vector svg xslt
Last synced: 2 months ago
JSON representation
Convert svg files to Android VectorDrawable (xml) – lean, java-free
- Host: GitHub
- URL: https://github.com/leso-kn/svg2vd
- Owner: leso-kn
- License: mit
- Created: 2021-01-08T16:57:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-17T18:56:05.000Z (over 4 years ago)
- Last Synced: 2025-02-03T13:12:37.732Z (4 months ago)
- Topics: android, android-vector, svg, xslt
- Language: XSLT
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# svg2vd
Convert svg files to Android VectorDrawable (xml).
Lean, java-free alternative to the 'Import SVG' feature in AndroidStudio.
## About
This repository contains an XSLT stylesheet, that can be used to convert svg files to Android's xml-based Vector Drawable format.
It was inspired by the work of [Rob Gilbert](https://github.com/fox015/svg2vectordrawable).
## Usage
```bash
> xsltproc [-o output.xml] convert.xsl [input1.svg ...]
```On Ubuntu for example, the `xsltproc` command is available via apt.
Of course, any other XSLT processor may be used just as well. The stylesheet does not require any XSLT 2.0 features.
## Features
Currently supports:
* Most common shapes
* Paths
* Polygons
* Rectangles
* Circles
* Ellipses
* Lines
* SVG Groups (group name and transform)
* Most common attributes
* Fill color
* Stroke color / width / linecaps
* Draw order
* Attribute inheritance
* Gradients
* Linear
* Colors and transparency
* Different SVG formats
* "Regular" SVG
* Inkscape SVG## Known issues
- Some svg features may not be supported (yet)
* In a very rare case with `` elements, the path-data may not be converted correctly
* This results in the 'out-breaking' of single path-points
* To me this happened only once, with a huge 2.5MB test svg file (exported from Adobe Illustrator)