Monday, August 2, 2010

[Quick-Tip][GIMP] Rounding any selection

One thing I was asked how to do several times, in GIMP, is how to round a selection which is not rectangular. For example, if you have start shaped selection and you want to round it's corners - how do you do this?

Today I'm going to show you a quick and dirty way to do this:
  1. Load the selection that you wish to round. Save it to a channel so that you will be able to undo what we are going to do.
    Step 1: Load the selection
  2. Shrink the selection by the radius you want to round it (i.e. if you want to round your selection by 10px, shrink it by 10px).
    Step 2: Shrink the selection
  3. Create a new layer. Now stroke the selection with round caps/joins and set the stroke width to double the radius of the rounding (Since I shrunk the selection by 10px, I'll stroke it by 20px).
    Step 3: Stroke the selection
    Note the settings of the
    "Cap/Join Style"
  4. Fill the selection (on the same layer you stroked the selection).
    Step 4: Fill the selection
    This is how your layer
    should look (without the
    selection)
  5. Now, transfer the alpha of the selected layer to the selection (aka "Alpha to Selection") and delete this temporary layer.
    Step 5: Transfer the alpha
    of the layer to the selection
    and get rid of the layer
That's all - A very neat result, even if the technique is a bit ugly :P

Tip: If you want a smoother result (some of you may notice small jags on the resulting selection) try the following instead of step 3:
  1. Convert the selection to a path (aka "Selection to Path").
  2. Deselect the image.
  3. Stroke the path (with the same settings as above).
  4. Make a selection from the path and delete the path.
Does anyone want a script to automate this? If so, leave a comment and I'll write one =)

    No comments:

    Post a Comment