Questioner
Questioner

Reputation: 2541

How do I export Android XML vector drawables to another format?

I want to recreate my app for iOS and the icons in Android are XML vectors with the "android:pathData" attribute. How do I convert these to an image that I can place into Xcode and use (preserving transparency)?

I have searched for a solution and found nothing and read the article on the Android Developer site on Vector Asset Studio but found nothing about exporting these drawables to something I can import into Xcode.

Upvotes: 12

Views: 7232

Answers (2)

Jay
Jay

Reputation: 54

After using the trick Questioner provide, I use a browser to open the svg file, zoom-in to the size as big as possible and take a screenshot. FYI.

Upvotes: -1

Questioner
Questioner

Reputation: 2541

I did it by creating an SVG file and copying the value of the pathData attribute of the path element in the XML file and pasting it into the d attribute of the path element in the SVG file. I then converted it to PNG using ImageMagick.

So

<path android:pathData="[Path Data]">

becomes

<path d="[Path Data]">.

Then

convert -background none image.svg image.png

in the command line.

If there is a better way of doing this please post it.

Upvotes: 7

Related Questions