Ask all general Gimp related questions here
Post a reply

Reduce line thickness

Wed Feb 23, 2011 4:51 am

Hi, Guys can you help me? I recently did a contour line on a map. I did all the contour lines 2 pixels wide, except for one which somehow was done 3 pixels wide. I thought it was a simple job to just reduce it by 1 pixel, but unless I am overlooking something I do not seem to be able to do this.
I include a small image which if you blow up to 800% in gimp you will see is 3 pixels wide. This is a practice one I made to play around with.
If someone can show me a way to easily reduce the line width to 2 pixels I will be very happy.
I have played with shrink/enlarge, blur/sharpen and paths. (even tried the advanced settings , but I haven't a clue what I am doing there!)
NB, this is not a calamitous problem as each contour line is on a separate layer and I can reproduce the layer with a line two pixels wide, but it is a longish job and a simple solution would save a lot of time.
3 pixels wide.jpg
3 pixels wide.jpg (8.91 KiB) Viewed 13118 times

Re: Reduce line thickness

Wed Feb 23, 2011 5:31 am

There are probably several ways to obtain this, one being you can mask out everything but the 3px contour, and then turn that contour to a path, erase the 3px contour and then stroke the path at 2px.

Re: Reduce line thickness

Wed Feb 23, 2011 6:07 am

Filters->Generic->Dilate in Gimp 2.7.1 at least does something like this.

Re: Reduce line thickness

Wed Feb 23, 2011 6:21 am

Too bad it doesn't have options for how much to dilate.

Re: Reduce line thickness

Wed Feb 23, 2011 10:51 am

I did try G'MIC's Skeletinize filter (invert Skeletinize invert since Skeletinize works on white lines), but it didn't quite give the result that I could except.

skel.png
skel.png (1.79 KiB) Viewed 13077 times


Kimpii's Dilate idea does give a better result, but still not true 1px.

dilate.png
dilate.png (4.68 KiB) Viewed 13077 times


As a side note, selecting all white then grow/fill with white 1px gives the exact result as dilate. :)

Re: Reduce line thickness

Wed Feb 23, 2011 10:53 am

mahvin wrote:There are probably several ways to obtain this, one being you can mask out everything but the 3px contour, and then turn that contour to a path, erase the 3px contour and then stroke the path at 2px.
The problem with the path is that it's a double-line path. I don't know how to make it a single lined one.

If you stroke the path you don't get a 2 pixel line.

Image

Re: Reduce line thickness

Wed Feb 23, 2011 11:14 am

Of course, there just anything better then tracing (tedious), but I only half A'd (you can figure out the word; lol) the trace work. :)

Re: Reduce line thickness

Wed Feb 23, 2011 11:14 am

kimppi wrote:Filters->Generic->Dilate in Gimp 2.7.1 at least does something like this.
mahvin wrote:Too bad it doesn't have options for how much to dilate.

That would be "Filters->Distort->Value Propagate".

Re: Reduce line thickness

Wed Feb 23, 2011 2:20 pm

I meant to create a path over the existing contour, erase the old line, rerun "Stroke Path" at 2px.

Re: Reduce line thickness

Wed Feb 23, 2011 5:28 pm

It seems you all run into the same problem as I did. It appears that all filters or scripts draw a double path that spans the line width (as per Oregonian) hence any manipulation done is multiplied by two. Adding will give you a 5 (3+1X2), subtracting will give you 1 (3-1X2)--- one on each side of the path created by selection of a 3 wide line. It appears that you can not make an even numbered line width from an uneven numbered line width and vice versa.
Tracing any width line to make a "single" path and subsequent stroking the path 2 wide will work but is not practicable in my case.
I only run a basic Gimp so do not have access to Gmic and all the other SCM's and Plugins and I believe that any solution would be within the basic Gimp.

Re: Reduce line thickness

Wed Feb 23, 2011 6:04 pm

If you mask out the other contour lines and leave only the 3px line showing, you can use Colors - Curves to reduce the size of the line. It might require a slight blur, and second Curves application to make it appear worthy for the rest of the contour lines.

Re: Reduce line thickness

Thu Feb 24, 2011 4:11 am

Hi, Mahvin, I've played around with what you suggest , but i am not having too much luck. It would be great if you could show me in a bit more detail perhaps with an outcome on my little test image. I am probably misunderstanding what you are trying to do!

Re: Reduce line thickness

Thu Feb 24, 2011 4:19 am

I think it would be simplest, and quickest to just redo the line :lol
What would work very nicely is an offset script.

Re: Reduce line thickness

Thu Feb 24, 2011 5:10 am

Rod I have already redone the line . As I said in my original post I can redo the line as it is on a separate layer. But the problem interested me. Suppose all the contour lines were on a single layer, it would be very difficult to recover and probably very time consuming.
I have just tried the same exercise in Ps and have exactly the same problem, so I think it is not possible to adjust a line width by a single pixel

Re: Reduce line thickness

Thu Feb 24, 2011 6:30 am

I use this technique extensively for thinning lineart, have done so for 2 plus years. It's just not "pixel" perfect, but pretty darn close. Bear in mind, that it sure beats having to redo a whole line from scratch. And if it can fool an observer, does it really need to be perfect? For some reason, the videos flicker when you watch them from gimpchat. It's best to watch them on YouTube, fullscreen.

www.youtube.com Video from : www.youtube.com

Re: Reduce line thickness

Thu Feb 24, 2011 6:37 am

wbool63 wrote:Rod I have already redone the line . As I said in my original post I can redo the line as it is on a separate layer. But the problem interested me. Suppose all the contour lines were on a single layer, it would be very difficult to recover and probably very time consuming.
I have just tried the same exercise in Ps and have exactly the same problem, so I think it is not possible to adjust a line width by a single pixel


Actually you could just cut and paste all the lines into separate layers and then edit the one's you needed to.
Not really that time consuming.Mahvins method of madness looks ideal though.
Kudos Mahvin! :bigthup

Re: Reduce line thickness

Thu Feb 24, 2011 7:00 am

I just saw mahvin's video on YouTube (benefits of being a sub, I get it emailed, and notified on YouTube)

Learned something new using the curves filter :)

Re: Reduce line thickness

Fri Feb 25, 2011 3:48 am

Thank You Mahvin for showing your method. It is a good easy way to make a line appear thinner.
Unfortunately it does not suit my application to make it appear thinner, I wanted it to be reduced in absolute pixel width and retain the aliassed staircase look.
I tried something very similar to your method before I re-did the whole line. In most applications where smooth anti-aliassing is used your method would be very useful.
Again thanks for your input.

wbool63

Re: Reduce line thickness

Sat Oct 22, 2022 10:27 am

I answered this at gimp-forum net

search "Thread make lines thicker on already drawn object?"

1. fuzzy select
2. select->shrink
3. cut and paste to where you want it
Post a reply