7

I am trying to create a rectangle shape with rounded corners that I can freely move around, align, fill, etc. I tried using the rectangle select tool and add a stroke, then copy that and paste as new layer, but the layer's stroke were cropped/semi-transparent on the right side and on the bottom.

If I try to create a rounded rectangle selection, and paste it as a layer, GIMP does not seem to want to keep the rounded corners.

How can I solve this problem?

10

Here's how I've done it:

  1. Create a new layer
  2. Make sure the layer has an alpha channel if it doesn't already (right-click, add alpha channel)
  3. Add a layer mask to the layer (right-click in the layer list, Add Layer Mask)
  4. In the layer mask options dialog, select 'White (full opacity)'
  5. You'll now have an additional little white square; this is the layer mask, and you can switch back and forth between the layer and the mask by clicking on each square. By default, you should now be working in the mask, which is what we want:

layer mask

Now, format the mask:

  1. Set the foreground paint color to black
  2. Choose the rectangle select tool, and set the rounded corner options that you want
  3. Drag to select the rounded-corner rectangle area that you want to be non-transparent
  4. Invert the selection (select | invert)
  5. Use the bucket tool to fill the areas outside the rectangle with black. Note that in fact, you're making those parts transparent, since you're painting on the mask rather than the layer, and black means transparent when you're working on the mask. So, whatever's behind should now start to show through. Before and after the bucket operation (my background layer is green):

enter image description here enter image description here

Change back to working on the layer by clicking on the left square next to the layer name, in the layer list.

I'm running Gimp 2.8.0, if that makes any difference.

  • 1
    Thank you. Just one note. This works for me only when I select 'White' in the layer mask options dialog. – raacer Jun 20 '14 at 22:52
  • Excellent explanation, but I, too, have found that the layer mask should be white. This makes the 'additional little white square' not black, too. :-) I've edited the answer, to save people having to redo it, as I did. This is in Gimp 2.8.10 – Michael Scheper Oct 30 '15 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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