Tips for specific bitmap trace

Post questions on how to use or achieve an effect in Inkscape.
perpendicular
Posts: 1
Joined: Sat Aug 20, 2011 2:46 am

Tips for specific bitmap trace

Postby perpendicular » Sat Aug 20, 2011 3:05 am

Hi all,i have a bitmap i am trying to trace and i would like to take your advice in what are the best options to use to get the best result for this case.It consists of a large (a bit over 500) number of adjacent shapes.All of them are filled with a solid color and none have an outline.Some are of the same color,but none adjacent shapes have the same color,so the slightiest difference in color should be considered a border of a shape.
Now,what i want to do is trace that bitmap but with 2 conditions:a)ALL shapes must be recognized successfully (for example when i used edge detection with a really small threshold i got a nice result but it still missed some shapes) b)i need not one path,but multiple ones,the ideal would be one path per color but one path per shape is totally acceptable.
So far i din't find the perfect set of options,does anyone have an idea what would work best in this case?

User avatar
BobSongs
Posts: 324
Joined: Fri Sep 14, 2007 2:18 pm
Location: Montreal, Canada

Re: Tips for specific bitmap trace

Postby BobSongs » Sat Aug 20, 2011 8:03 pm

Off hand... if I had the task that you mention here, I think what I would do would be a few work-arounds.

First, and the most tedious, would be multiple attempts at running the trace using tiny changes to the parameters.

Second, once a decent and fairly acceptable software trace was done, I'd look for some of the shapes that were missed. (Time being of the essence.) Then I would use the :tool_pencil: or :tool_pen: to manually trace the missing pieces (assuming there aren't 300 missing pieces). I would do this by having the original bit map on its own layer. Then I would cut the trace produced by Inkscape and paste it in its own layer above the bitmap.

The trace tool is a good addition to Inkscape, but it does have its limitations. The only way I've gotten decent results is by hammering at it for some time, constantly changing the figures.

But if anyone has a perfect trace setting, I'd love to hear about it.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Tips for specific bitmap trace

Postby brynn » Sun Aug 21, 2011 6:08 am

Image
Welcome to InkscapeForum, perpendicular!

I would 2nd BobSongs suggestions, plus add a couple more, and some comments.
Trace Bitmap is not meant to accurrately reproduce images, and as you've learned, is very tricky to use successfully with an image such as yours. It sounds like you've made a good start, and just need a little more patience, and more experimenting. If you have time, there's another vectorization trace engine here: http://www.roitsystems.com/cgi-bin/autotrace/tracer.pl I can't say it's better or worse than Inkscape's native trace engine, but it just works differently, and produces a different result. It's benefit is that is has a centerline trace option, which you might find works better for you. All I can say, is have a look and give it a try.

For Trace Bitmap, I'll show you an example. I chose an image which might fit your description of your image (although yours sounds more like a map, I don't have an image of a map), and you can see the settings that I used. Also, I realize you said your doesn't have any borders/strokes, but there are areas in my example where there isn't black outline. So you can use those areas for illustration.

Image

After the trace is completed, use Alt + click to locate your original image, and move it aside. It's stacked up with all the traces, making it hard to see your result. Be sure to watch the status bar, to see whether you've selected the original (Image 160 x 193 for mine) or the traces. Here, my original is on the left. If you've selected the traces, it will say Group of 60 (in my example).

Image

Next select the Group of 60, and Ungroup (Object menu or in command bar). The status bar will now say "60 objects of type Path". Each path object represents one color. From here, depending on the complexity of your image, it might be nearly impossible to select a particular color/path/object, and if that's the case, I can take you through some steps to do so.

It doesn't seem like my image actually has 60 colors in it, but I found that I had to use 60 scans to get accurrate colors. And what happens is that at the border of 2 colors in a raster (bitmap) image, it might show strips of several colors transitioning from one to the other. So to get one path for one object, you might have to look at 3 or 4 different scans, and choose the one that's closest to the right size and shape. You can change the color, if it's not quite right. You might well find that you can use a much smaller number than 60, and not have much trouble selecting each one. Alt + click will again be the usual method for doing that. But if you find it too difficult, let me know, and I can give you a process that might help. (I know you said over 500 shapes, but I'm not sure if that means 500 different colors.)

Even with this relatively nice trace of my sample image, the shapes might still not be entirely accurrately drawn. I expect you might need to use the Node tool to tweak things, here and there, especially for those instances where you have to choose among several scans. So keeping the original on a separate, lower layer, is a good idea, to help with this tweaking. You can change the opacity of the layer, or hide it entirely, as needed.

Do you need each color to be on its own layer? Sometimes when member presents this issue, they are making designs for t-shirts, and need one color on each layer, for the screenprinter. If so, first create your layers, then select each color/path/object, and move to proper layer (Shift + PgUp or PgDn).

Let us know how it goes :D


Return to “Help with using Inkscape”