Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Color selection tool
#1
Dear all,

I'm vectorizing images with the help of GIMP. I start with an image like this:

[Image: Originale.png]then with the color selection tool I select all the lines:


[Image: Strumento.png]

ad after I export the selection to Qgis, with an apposite tool. The problem is that the selection for each line  is "doubled": one for one side, one for the other. Here a zoom:

 [Image: Ingrandimento.png]

Well...is there the possibility for GIMP (maybe with a different tool) to select with just a "line selection", right in the center of the original lines?

Thank you
Reply
#2
Gimp is a raster (bitmap) graphics tool. Works with (usually) square pixels. The semi-transparent ones you see are 'anti-aliasing'  pixels  added to give the impression of smoothness.

If you want a solid line of single pixels then dis-able the Colour Select Tool  anti-aliasing and increase the threshold value to 50- 70  something like this. Then fill the selection on a new layer.

   

However Gimp is not the tool for vector work. Inkscape is and your original png converted to a SVG looks like this.

   

Edit: If a black / white image is ok for Qgis then you can use The threshold tool Colors -> Threshold

   
Reply
#3
Thank you rich2005,

things are a little more complicated: the raster image in geotagged and have others data inside. I suppose Inkscape cannot convert mantaining georeference and data. Another problem is importing svg to Qgis.

So...gimp seems the answer, problem is just those double lines.

Thank you for the efforts!
Reply
#4
There is always a way, although not too sure that Gimp will retain the geodata Wink

Try
1. Layer -> Duplicte the layer
2. Colour pick that yellowish color
3. Color select the white background
4. Select -> Grow 1 pixel
5. Fill the selection with White (drag in from the BG swatch)
6 Select -> Invert (the selection)
7 Fill with the FG 'yellowish' colour (drag in from the FG swatch)
8. Select -> None to turn the selection off
9. Turn the visibility of the top layer off and make the bottomlayer active
10. Colors -> Threshold to give a BW layer
11. Back to the top layer and make it visible
12 Set the top layer mode to 'Darken Only'
13. Layer -> Merge Down to merge the layers.

Lots of steps but I can get in 1 minute demo https://i.imgur.com/A2N8D5e.mp4

There will be other ways.
Reply
#5
Dear rich2005,

thank you for the efforts, but I can export the "select by colour" selection to Qgis via gimp plugin. I export ONLY the selection, that's a vector object. The problem is to select just a line and not two lines:

[Image: Ingrandimento.png]

One line in the original raster image gives two "select by colour" dotted lines. Those dotted lines are the vector export to Qgis software. So my problem is to have just one dotted line per original raster line. Maybe "select by colour" tool is not the best tool...but my GIMP knowledge is very trivial Sad

Thank you for all the efforts!

P.s.: here the selection in qgis:

[Image: Qgis.png]
Reply
#6
I think you have the wrong idea about selections.

Quote:I'm vectorizing images with the help of GIMP. I start with an image like this:....snip....

And you select the black borders. Because the lines have anti-aliasing to 'smooth' them the selection includes the light coloured pixels - Remember what I wrote, Gimp is a raster editor, the image is made up of rectangular pixels. You can not split a pixel with a selection, you get the border.  

Quote:...Those dotted lines are the vector export to Qgis software..

They are not a vector they are a selection.  You can remove the light coloured pixels as previous post but the selection will still be the outline. 

Quote:..snip..Well...is there the possibility for GIMP (maybe with a different tool) to select with just a "line selection", right in the center of the original lines?

Right in the center means a path and that it is a vector. It has zero width in Gimp. A path can be stroked to give a line, then it is back to either single pixels or an antialised line depending on how the stoke is applied.  If you select the path then it is  back to an outline selection. Gimp can save the paths in a Gimp .xcf file. This example attached with active selection and path so you can see the difference.

   

How are you uploading the 'selection' to Qgis ? Png or jpeg are not vector formats - no paths. You already said that it does not support svg vector format. Any other vector formats available ?

Edit: Is it this plugin https://plugins.qgis.org/plugins/gimpsel...rsion/1.6/ ?

A vector (path) might not give the best result. The path provided a selection Select -> From Path but that includes any pixel the path crosses.  You might be better off with just the single pixel lines as discussed previously.

   


Attached Files
.gz   one-pixel-with-path.xcf.gz (Size: 12.53 KB / Downloads: 114)
Reply
#7
(11-08-2021, 11:14 AM)rich2005 Wrote: Edit: Is it this plugin https://plugins.qgis.org/plugins/gimpsel...rsion/1.6/ ?

Yes it is. In qgis I have a georeferenced vector. It seems there is not a fast solution at the problem Sad

Thank you for the help!
Reply


Forum Jump: