Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vector Asset Studio is importing colorful .svg file as black and white

I'm using the instructions found here, from Google to use the new option (March 2016) to import .svg files into drawable instead of .png files.

The problem I have is that the file gets imported as black and white, even though the file has many colors.

Here's an image of the .svg file, as read by Google Chrome: enter image description here

This same file, is then read like this by the Vector Asset Studio: enter image description here enter image description here

And in the app, the image shows up as black and white.

Any idea of why this is happening?

The .svg file is getting generated on Adobe PhotoShop Creative Cloud, and I'm using Android Studio 1.5.1 on Mac.

Thank you!

EDIT: added link to .svg file I'm using for this question.

like image 884
TooManyEduardos Avatar asked Mar 07 '16 18:03

TooManyEduardos


People also ask

Why are my SVG files black and white?

It seems to be an issue with the nested groups. If you open the newer file in Inkscape, while you can see the colors, if you click any of the objects, you'll see "Paint is undefined" in the `Fill and Stroke window. A simple fix is to simply remove the extraneous groups.

Can SVG files have color?

Additionally, SVG content can specify an alternate color specification using an ICC profile [ICC42] as described in Specifying paint.

Why is my SVG filled black?

If you upload a complex design into Design Space it may give you both “cut” and “print and cut” options. If that happens, the cut-only image will be black.

Are SVG vector files?

What is an SVG file? Scalable Vector Graphics (SVG) is a web-friendly vector file format. As opposed to pixel-based raster files like JPEGs, vector files store images via mathematical formulas based on points and lines on a grid.


1 Answers

I also had the same problem but after digging internet finally found the solution, here it is:-

After getting done with illustrator designing

1) Go to File --> Save As ---> Window Dialog box Opens--> type name of svg --->Click Save

2) Now it shows SVG Options dialog box ---> At bottom left click More Options ---> In CSS Properties dropdown ---> Select Presentation Attributes

this setting makes svg compatible code for android import with colors !!

Sorry for making this answer elaborate ... did this for those who are beginners

like image 167
Vibhore Agg Avatar answered Oct 04 '22 19:10

Vibhore Agg