svg2vd
is an SVG to VectorDrawable
command line tool.
You can install svg2vd
using npm w/ the following command:
npm install -g svg2vd
Usage: svg2vd [options] [file]
Options:
-V, --version output the version number
-s, --string <string> input SVG string
-i, --input <file> input file/directory, or "-" for STDIN
-o, --output <file> output file/directory (an XML file w/ the same name as the input file by default), or "-" for STDOUT
-d, --dir <dir> convert all *.svg files in a directory
-q, --quiet only output error messages
-h, --help output usage information
# Convert an SVG to VectorDrawable.
svg2vd filename.svg
# Convert all files ending with '.svg' to VectorDrawable.
svg2vd *.svg
# Convert an SVG to VectorDrawable and write the output to a new file.
svg2vd filename.svg -o vector.xml
# Convert an SVG to VectorDrawable using standard input and standard output.
cat filename.svg | svg2vd -i - -o - > vector.xml
# Convert all SVG files in a directory.
svg2vd -d path/to/directory
# Convert all SVG files in a directory and write them to a new directory.
svg2vd -d path/to/input/directory -o path/to/output/directory
# Convert all files ending with '.svg' and write them to a new directory.
svg2vd *.svg -o path/to/output/directory
# Pass a string as input and write the output to a new file.
svg2vd -s '<svg>...</svg>' -o vector.xml
If you want to contribute, first be sure to install the latest version of
Node.js
and npm
.
If you're not sure what IDE to use, I highly recommend checking out
vscode.
Then clone this repository and in the root directory, run:
npm install
To build the tool, run:
npm run build
To test the tool, run:
npm run test