Mobile app version of vmapp.org
Login or Join
Samaraweera207

: “Select by color” and “draw path from selection” in Inkscape? 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)

@Samaraweera207

Posted in: #Images #Inkscape #Selections #Shapes #Svg

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:



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,...

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera207

3 Comments

Sorted by latest first Latest Oldest Best

 

@Sarah814

Just found your question. Here is a solution based on a Forum post by user 'loonquawl':


You open the XML Editor (under Edit) and look for the color used (select the object on the canvas, and it gets highlighted in the XML Editor), copy the color (it is one of the values in "Style" e.g.
fill:#ffff00 and insert it into the Style Box in the Search Dialog (Strg F)

Hit enter


I just tried this and it works perfectly.

10% popularity Vote Up Vote Down


 

@Karen819

The way pointed by @Takkat is correct, but it depends a lot of your source image.

Your source image seems a very small matrix image, like this:



Using such an image, Potrace show a misleading preview: the image is too little and you need to trick a lot with the parameters in order to obtain something decent:



I suggest you to scale your starting image without applying interpolation, and saving it as indexed image:



In this ways the tracing is a lot better:



The options used for this example are:


Mode: colors
Scans: 8 or 70 (note the difference)
No smooth
No stack scans
Yes remove background
In options tab, uncheck all

10% popularity Vote Up Vote Down


 

@BetL875

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.


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

Wikimedia
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)

Choose Object > Ungroup.
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):


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






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):



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



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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme