GIMP Forums

Full Version: Cropping problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to make a box with the top corners rounded and the part outside the box at the top two corners to be transparent.

I created a new image and then added a layer named bottom. I moved this layer to the bottom and named the first layer Top.

On the Rectangle Select tool I checked the rounded corners option. I selected the entire box and then cropped to the selection. I selected the top layer and filled it. The entire top layer turned gray (my fill color). The two corners that I thought I cropped did not get cropped.

I was planning to resize the image to get the square corners for the bottom of the box. I want to put a border on the box with the rounded corners but have no idea how I select just the borders and then Paint them. But until I figure out how to get the rounded top corners I see no need to continue.

What did I do wrong?

(Feb 2, 2011 04:16)bsprowl Wrote: [ -> ]What did I do wrong?
Image or layer can only be rectangular shape

To make the box:

1. Create new image [in 'Advanced Options' choose Fill with: Transparency]
Layer->New layer [Layer Fill Type: Transparency]
You can delete all other layers if you want

2. Select the box [Rectangle Select Tool with rounded corners option, remember the radius for future use]

3. Fill the selection with desired color [Bucket Fill Tool]

4. While selection is still on get rid off extra work space
Image->Crop to Selection
Layer->Crop to Selection

5. Select->None

6. Select lower part of the layer and bucket fill lower corners of the box

To make the border (probably, can be done better):

1. I would try to make the same selection as in 2. above, then drag it smaller, adjust radius...
[You can save selection from 2. as a channel but if you try to Select->Shrink it
antialiasing won't be pretty]

2. Selection->Invert

3. Check 'Lock alpha channel' box for the layer in Layers Dialog and bucket fill or paint the border, uncheck the box

4. Work on the lower part of the box
I saw you asked the same question on GimpTalk forum and got good answers.
I just want to add couple of things I've figured out while looking around on the topic.

First of all, my approach (above post) is legitimate, but it is definitely better to make complete selection first [rounded top + rectangular bottom holding Shift button] and then work with it.

Second, it turned out that Edit->Stroke selection... and Edit->Stroke path... give noticeably different results. Since you have defined dimensions, it is better to convert selection to path and stroke path.

Third, when you stroke an already filled path, background color shows through the anti-aliasing. It is so minor thing. But it is the only one where my approach shines Smile

Fourth, almost unrelated note I've found out.
It is possible to center selection inside a layer. Actually, the other way around, so you need some extra working space. It is done with the help of the Alignment tool. Click the layer, choose Relative to: Selection and press 'Align center of target' and 'Align middle of target'.

PS I am learning Smile

PPS I can't see my attachments when I Preview Post. I hope they'll show up later. Smile
Thank you.

It looks like it is never a good idea to stroke a selection. Right?

Here is my final take...
I apologize for one big image.
First, raw data...
Selection No.1: 50x50, antialiasing, rounded corners radius 11.0, filled
Path: 48x48, -- same --, stroked with 2px line, cut to 50x50, filled

Since selection No.1 and selection that was converted to path have same corner radius but are different dimensions I would suggest that it makes visual difference.


Please, explain. What point you were trying to make?

Since 'stroke path' is better than 'stroke selection', it should mean that 'shrinking' selection and stroking corresponding path is better than just filling selection.
It doesn't make sense only for complex selections and for feathery ones.
Sounds tiring. Undecided

Unfortunately, it is not easy to do the right curve for small selections or for wide strokes(?). (Like in your case, final box doesn't have 11px radius. But probably no one needs it. Smile)

P.S. JUST LEARNED: Radius for rounded corners in options for Rectangle Select Tool is in px and only up to 100px.
To define radius as a percentage of the shorter side of the rectangle there is Select->Rounded Rectangle. (Good for larger rectangles, but performs strange for 100x100, for example.)
Second thought:
Am I right or not that...

while the selection is being constructed, for example with Ellipse Select Tool, information that it is an ellipse, in a vector sense, is still available to the GIMP. All antialiasing and feathering are calculated with this knowledge. It means that bucket fill this selection is the same as rasterizing solid vector ellipse.

In case of a border, GIMP works with already defined selection and there is only transparency information at this point.

It seems that drawing rounded box and filling it with color is good enough.

Interesting yesterday article:
section Rounded Rectangles (for Photoshop)
(Feb 8, 2011 20:54)ofnuts Wrote: [ -> ]I have found "experimentally" that this is not the case. And a look at Gimp's source code confirms this: the ellipse selection is at once transformed into a mask.
I meant that...
while you are checking and unchecking options for a Select Tool you have not yet technically finalized you selection, so GIMP knows numbers, not transparency info.
Right after you have finalized your selection, it is a mask.
The selection is not bad at this point. Exactly the same as if it was done from a path.
(for Rectangle and Ellipse selections)
Reference URL's