It is currently Sun Apr 28, 2024 9:42 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 16 posts ] 
Author Message
 Post subject: corners rounded when growing
PostPosted: Wed Aug 22, 2012 12:55 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Apr 30, 2010
Posts: 1937
Location: Missouri
GIMP Version: 2.6.11
Operating System: Windows
OS Version: 7 pro
GIMP Experience: Intermediate Level



I know there has to be a simple way to fix this but I haven't found it yet. I've attached an example to help illustrate it. When I make a polygon, in this case a rectangle, then grow the selection the corners are rounded, as seen in the white layer. I don't have rounded corners turned on and even if I did I have it set to 0. Is there a setting I've been overlooking or is this just a gimp quirk? BTW I'm using 2.8, not 2.6.

_________________
Image
The last time I kept an open mind,
my brain fell out and the dog grabbed it.
Now it's full of dirt, toothmarks, and dog slobber.
No more open minds or dogs for me.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Aug 22, 2012 1:19 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Mar 23, 2012
Posts: 7309
Location: Göteborg at last!
This happens to me too in 2.6.11. It's a nuisance but I don't know if there is any way to correct it.


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Aug 22, 2012 1:37 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Growing or shrinking a selection works, not by scaling the selection (which would be problematic in most situations) but, by painting around the selection's perimeter (its marching ants) with a round brush*. This results in a rounding of corners when a rectangular selection is grown.

Attachment:
selection.png
selection.png [ 2.99 KiB | Viewed 6512 times ]



* The actual algorithm is a little more complicated since it tries to retain any feathering that might exist in the original selection, but for the purpose of understanding why the corners get rounded when a selection is grown, this explanation should suffice.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Aug 22, 2012 1:39 pm  (#4) 
Offline
GimpChat Member

Joined: Aug 05, 2011
Posts: 606
Location: limestone,ny
Saulgoode explains a trick for this in this thread, just tried it and it works
from the thread..
A good way to correct for this is to, in the case of growing an elliptical selection, clicking within the grown selection with the Elliptical Select Tool. This will cause the resizing handles to appear. Move the mouse to the top resizing bar and then press the cursor left key on your keyboard*. This will result in a "new" elliptical selection that is the same size as the original, but with the distortions caused by growing eliminated. Click in the center of the selection (or press ENTER) to accept this corrected selection. (A similar operation can be used for rectangular selections, only with the Rectangle Select Tool.)


* Alternately, you can place the mouse pointer over either of the side resizing bars and use the up or down cursor key -- the idea is to not actually resize the selection, but to "trick" GIMP into thinking you have.


view topic


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Aug 22, 2012 1:51 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
You could also resize from the center and use the dialog box to precisely change size in GIMP 2.8

Image

or turn into a path and move the handles manually

Alan


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Aug 22, 2012 2:15 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
Another alternative would be to use the [stroke path] [Line Style] [Join Style] [Miter]

Image

this would work on many different angles and not just 45 degree corners.


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Aug 22, 2012 4:40 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Apr 30, 2010
Posts: 1937
Location: Missouri
I've started just making 4 guides around the edges and drawing another rectangle, I'll try the other ideas mentioned. I was thinking it was just me doing something wrong.

_________________
Image
The last time I kept an open mind,
my brain fell out and the dog grabbed it.
Now it's full of dirt, toothmarks, and dog slobber.
No more open minds or dogs for me.


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Aug 22, 2012 9:35 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Here is a .scm I wrote (long ago) that can help do what you want. http://www.silent9.com/incoming/scripts ... tional.scm It creates eight menu items under Select>Directional Grow>Grow Left (right, up and down, left 10, right, 10 etc.) The alt-cursor keys are not used in gimp, so you can use Edit>Keyboard Shortcuts to set them up. Here is a screen grab of the keybindings I set up:

Image

SO to grow all directions by one pixel, just use (hold the alt key) and cursor up, down, left, right. or by 10 pixels (hold Shift-Alt) and cursor up, down, left, right.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Last edited by RobA on Mon Apr 22, 2013 8:24 pm, edited 1 time in total.

Top
 Post subject: Re: corners rounded when growing
PostPosted: Thu Aug 23, 2012 12:03 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Aug 16, 2012
Posts: 4271
Location: Göteborg, Sweden
rob a: that looks like a very helpful script, i'm going to try it out at once!
(i'll be very careful with the alt+up commando though - who knows what it will do to my taste in clothes and music ;))

_________________


Top
 Post subject: Re: corners rounded when growing
PostPosted: Thu Aug 23, 2012 8:23 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Apr 30, 2010
Posts: 1937
Location: Missouri
I grabbed it, Rob. Thanks

_________________
Image
The last time I kept an open mind,
my brain fell out and the dog grabbed it.
Now it's full of dirt, toothmarks, and dog slobber.
No more open minds or dogs for me.


Top
 Post subject: Re: corners rounded when growing
PostPosted: Thu Aug 23, 2012 11:36 am  (#11) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
A simple quick but neat approach may also be

1 convert selection to path
2 scale the path up or down
3 path to selection

The difference is that should work with any selection shapes not only rectangular avoiding any rounding or sharpening (not sure if sharpening is the right word i used to indicate the opposite of rounding referred to the angles ) because path are not modified by scaling.

Only limitation i see it will remove any feathering from the selection

It should be also possible automatize in a script

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: corners rounded when growing
PostPosted: Thu Aug 23, 2012 7:34 pm  (#12) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
PhotoComix wrote:
A simple quick but neat approach may also be

1 convert selection to path
2 scale the path up or down
3 path to selection

The difference is that should work with any selection shapes not only rectangular avoiding any rounding or sharpening (not sure if sharpening is the right word i used to indicate the opposite of rounding referred to the angles ) because path are not modified by scaling.

Only limitation i see it will remove any feathering from the selection

It should be also possible automatize in a script


Scaling a path has the same problem as scaling the selection - it only works if the selection is uniform. If you start with (for example) an H shapes selection scaling can not outset it equally around all sides.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: corners rounded when growing
PostPosted: Thu Aug 23, 2012 9:11 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Thanks Rob.This is going to come in very handy. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: corners rounded when growing
PostPosted: Fri Aug 24, 2012 3:12 am  (#14) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
The current outsetting (Select/grow) finds a line with a constant distance from the original selection. This implies rounded corners... The problem with sharp corners is that the conept is ill-defined.

One possibility is to extrapolate lines parallel to the sides until they intersect... but this opens the question of th extrapolation itself. The trivial method would be to draw a straight line that continues the curve, but this will certainly lead to very artificial corners.

Another is to find the shape which, when shrunk, would produce the original line. But there are an infinity of them (including the one obtain by the trivial extrapolation above).

... which makes me think that the best way to avoid the problem is to create the outside shape first and shrink it to obtain the inner shapes...

_________________
Image


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Dec 12, 2018 9:19 am  (#15) 
Offline
New Member

Joined: Dec 12, 2018
Posts: 1
Hey there. The script works. What works as well is:

Grow selection by only 1px. This keeps the rectangle without rounded borders.

Repeat as many times as you want. (may want to add a hotkey)


Top
 Post subject: Re: corners rounded when growing
PostPosted: Wed Dec 12, 2018 11:25 am  (#16) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
But if you want to grow more?

Actually three is a solution:

- polygon to path (via polygon to selection + selection to path)
- on an additional transparent layer, Edit>Stroke path, line mode, pointy corners, width=2x the required polygon growth
- Alpha to selection on the result
- Add that selection to the polygon selection
- remove the layer

_________________
Image


Top
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) What's the best tool to snip out corners

2

No new posts Python rounded rectangle bucket fill problem

1



* Login  



Powered by phpBB3 © phpBB Group