Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers 3

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.

share|improve this answer
    
I edited my question. The path are not drwan along the borders of "colour changes", but somewhere in the middle. I there a way to choose a single colour? –  R_User Nov 26 '13 at 23:42
add comment

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:

small image

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:

not a good tracing!

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

indexed image

In this ways the tracing is a lot better:

a better tracing

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
share|improve this answer
    
Should the scaling be done in a software different from Inkscape? I tried Object / Transform / Scale but stil it does not work (there was no option for smothening effects). I also have the Problem, that when saving the image as PDF, it becomes blurry. It seems that my PDF-viewer applies some interpolation,... To be honest, I don't want to change the size of each imported image manually in asoftware different from Inkspace. Can I somehow transform the image (its a sall PNG) to vector format (ideally, while importing the image)? –  R_User Nov 27 '13 at 11:33
    
@R_User for a better control of the image the scaling should be dome with a software specific for raster images, like Gimp, Photoshop or many other (it's a basic operation). In order to automatize the process you can try with ImageMagick, for example convert -scale 2000% little_image.png big_image.png outputs an image which could be imported in Inkscape. For a batch processing, with a little more work you could invoke potrace command-line with the big_image (not tried yet). –  Paolo Gibellini Nov 27 '13 at 12:14
    
@R_User Update: it seems that potrace cannot handle natively color images (Inkscape people added the support to colors through preprocessing). Here is an interesting topic, with a Python script for batch-tracing (not tried). –  Paolo Gibellini Nov 27 '13 at 12:26
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.