Advertisement


“Select by color” and “draw path from selection” in Inkscape?


Question

I imported an image to Inkscape. Now I'd like to select all those regions that have the same (or to a certain degree similar) color. From this selection I'd like to draw a path (to which I can add a border or background color).

I'd like to generate an object, that has the exact dimensions as a certain region in an Image. How can I do this with Inkscape? I couldn't find one of the functions above, but I'm sure there in a easy way to do this.

EDIT: The answer by Takkat looked quite promising. Unfortunately, although I turned off all smothening options, the paths do not follow the colours precisely:

Before:

before

After:

after

The same things are happening, when I use other scan-modes. I couldn't find an option that follows the border of the enlarged pixels,...

2013/11/26
1
6
11/26/2013 11:39:00 PM

The way to generate objects by color in Inkscape would be to trace the bitmap to vector paths.

This is how I selected the color yellow of the sunflowers to add a white border to all sunflowers.

  1. File > Import bitmap (embed) to the Inkscape canvas:

    enter image description here Wikimedia

  2. Select the bitmap and choose Path > Trace Bitmap...:

    • In Mode tab choose Colors, and Smooth. Do not Stack scans.
    • Reduce number of Scans until the desired object is clear (here I used 6)
  3. Choose Object > Ungroup.

  4. Delete all objects of unwanted colors until only a single color is left over (imported bitmap is removed here only to better demonstrate the effect):

    enter image description here

  5. Select the single yellow object to adjust Stroke or Fill settings to desired values (here I applied a 6 Pixel white stroke):

    enter image description here


For a higher precision of the trace (down to pixel size) we may have to scale up our source bitmap, depending on its content. The example below show a detail from above image linearly scaled by 1000% to reveal pixel blocks (left). Then I traced this image (right) with 12 color scans and without any path optimization (i.e. disable all, Smooth, Suppress speckles, Smooth corners, and Optimize Path):

enter image description here

We now can select all yellow objects, create a union object from these, and adjust fill and stroke (here a 10 px white stroke):

enter image description here

Note: Tracing large upscaled bitmaps will result in an immense amount of data. Your computer will need enough RAM to handle this.

2013/11/27
5
11/27/2013 7:07:00 PM