Sunday, June 23, 2019

vector - How to get rid of these outline artifacts in an Inkscape SVG trace?


I can get good trace results in Inkscape converting a bitmap to a vector image - except for these persistent thin outline artifacts. They resemble a topographic map and pretty much ruin the trace.



There are no strokes on these paths, just fills. So there shouldn't be any visible outlines.


stroke disabled


In case it helps, here are my trace settings: Inkscape trace settings



Such artifacts appear in Illustrator traces as well. But specifically I'm seeking a solution for preventing or removing them in Inkscape SVGs.



Answer



The problem is basically in the way Inkscape is deciding to split your image into color regions: instead of simply having the lighter colors overlap the darker ones (or vice versa), you're ending up with two adjacent color areas that both overlap a third color.


Since the edges don't line up perfectly (due to both tracing inaccuracies, and also some fundamental limitations of anti-aliased vector image rendering), some of that third color ends up showing through the gap, creating the "edge" you're seeing.


Alas, I don't know of any good way to fix this issue. You can get rid of the background colors by unchecking the "stack scans" box, but then you get transparent gaps between all paths, which is generally even worse. Sometimes, it may be possible to obtain acceptable results by tracing the image with "stack scans" unchecked, and then applying a small outset (say, 0.5 px) to all the resulting paths to fill in the gaps, but don't expect this to preserve fine details very well.


For your specific example image, one possible solution might be to trace it in grayscale (i.e. selecting "Grays" instead of "Colors") and then re-coloring the traced image afterwards; the grayscale tracing mode doesn't seem to suffer from this issue (which I'd really consider a bug, or at least a design flaw, in Inkscape's color bitmap tracing). Of course, this only works well for images that are essentially monochrome, or otherwise have simple and easily recreatable coloring.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...