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.
svg: The Scalable Vector Graphics format is based in XML (a markup language used widely across the Internet that's readable by both machines and humans). It's useful for the web, where it can be indexed, searched, and scripted.
A VectorDrawable is a vector graphic defined in an XML file as a set of points, lines, and curves along with its associated color information. The major advantage of using a vector drawable is image scalability.
The drawback is that they might take longer to draw, etc since there's more of parsing and drawing going on than just using a bitmap. This should although be neglectable if you keep your vectors simple.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With