SVG to PNG - lines invisible

75 Views Asked by At

Problem: some svg drawings open well in chrome and edge but not in inkscape or do not convert well with imagemagick. In my case only the text-labels were shown, no lines or drawings at all.

I could not find a solution on stack-overflow or google, the problem seems to occur with others to, but with no answer why and/or with no solution

1

There are 1 best solutions below

0
Pascal Declercq On

After a lot of searching, I found the reason why: the colors in my SVG were speficied like this:

stroke:RGB(0,0,0);

According to the SVG spefication, this seems ok, only the specs mention 'rgb' in lower case. When I converted 'RGB' to 'rgb' in my drawings, they were processed correctly in chrome, edge, inkscape and imagemagick

My correction in C# as inspiration:

var allText = File.ReadAllText(fileName);
allText = Regex.Replace(allText, @"RGB\((\d+),(\d+),(\d+)\)", @"rgb($1,$2,$3)");
File.WriteAllText(fileName, allText);