Skip to content
/ svg2vd Public

Convert svg files to Android VectorDrawable (xml) – lean, java-free

License

Notifications You must be signed in to change notification settings

leso-kn/svg2vd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

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.

Usage

> 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 <polygon> 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)

About

Convert svg files to Android VectorDrawable (xml) – lean, java-free

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages