Is there a way to bulk convert svg files using And

2020-07-05 03:19发布

问题:

I have a large number of svg files I want to convert to xml vector assets for Android.

The documented process is, for each file, File->New->Vector Asset. Then choose the svg file, click Next then Finish.

Is there a faster way? Maybe a bash comment to launch Asset Studio?

回答1:

There are few Git projects which would help you achieve the bulk conversion of svg files to Vector Drawable supported by android.

  1. Juraj Novák's : http://inloop.github.io/svg2android/
  2. SvgToVectorDrawableConverter original repo was deleted. But you could choose one of the fork . Example: svg2vd -i "\*" -o out --fix-fill-type
  3. For single conversion: SVG to Vector Drawable Convertor online
  4. Use wrapper of original converter ported from Android Studio

Hope it helps!



回答2:

download this jar file and use it as in the bellow example

java -jar C:\Users\dan\Downloads\Svg2VectorAndroid-1.0.jar C:\Users\dan\Desktop\svgs_dir


回答3:

Keep Svg2VectorAndroid.jar and the folder that having all the Svg file in same folder and then open cmd and go to that folder path where you put your jar and source folder and then execute the command

java -jar Svg2VectorAndroid.jar <source folder name>

and press enter. Now you can get your all xml file in source folder with folder name ProcessedSVG.

Hope it helps.



回答4:

There is now an easier way to do this using Android Studio's Resource Manager tool. See this answer for details.



标签: android svg