Post Reply 

Gradient - Blend Along a Rounded Corner?

Jan 24, 2012, 12:42 (This post was last modified: Jan 24, 2012 13:04 by Fretman.)
Post: #1
Gradient - Blend Along a Rounded Corner?
I'm trying to make a rounded-corner box with a gradient-style border. Obviously, the straight sides of the box are easy to create the effect for, but not so the rounded-corners.

How to I get the gradient to follow the curve - to blend from the curved edge - rather than just giving me a linear gradient as if I was doing it from a rectangular corner?

I tried some other gradient types, there didn't seem to be anything that did the trick.

I'll try to attach a quick test file, if it lets me, to illustrate what I'm talking about. Note how the gradient cuts out diagonally across the rounded corner rather than curving and following the corner around.

Or is there a different way to create this kind of border?


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Jan 24, 2012, 14:19
Post: #2
RE: Gradient - Blend Along a Rounded Corner?
That's what the "dimpled" gradient is for. It stretches the gradient from the border of t e selection to the center. This may require to use a gradient which is uniform on most of its range.

The other solution is to use my "Wrapmap" filter

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 24, 2012, 16:32 (This post was last modified: Jan 24, 2012 16:32 by Fretman.)
Post: #3
RE: Gradient - Blend Along a Rounded Corner?
(Jan 24, 2012 14:19)ofnuts Wrote:  That's what the "dimpled" gradient is for. It stretches the gradient from the border of t e selection to the center. This may require to use a gradient which is uniform on most of its range.

The other solution is to use my "Wrapmap" filter

The dimpled gradient didn't do it right (first attachment). I found I can get the effect by selecting a smaller rounded rectangle inside the larger one, feathering it then deleting it (second attachment). This leads me to another beginner question I have: how do I scale down a selection evenly... and position it perfectly in the center?

Thanks for your Wrapmap link, looks like that could be useful.


Attached File(s) Image(s)
       
Find all posts by this user
Quote this message in a reply
Jan 24, 2012, 21:00
Post: #4
RE: Gradient - Blend Along a Rounded Corner?
(Jan 24, 2012 16:32)Fretman Wrote:  
(Jan 24, 2012 14:19)ofnuts Wrote:  That's what the "dimpled" gradient is for. It stretches the gradient from the border of t e selection to the center. This may require to use a gradient which is uniform on most of its range.

The other solution is to use my "Wrapmap" filter

The dimpled gradient didn't do it right (first attachment). I found I can get the effect by selecting a smaller rounded rectangle inside the larger one, feathering it then deleting it (second attachment). This leads me to another beginner question I have: how do I scale down a selection evenly... and position it perfectly in the center?

Thanks for your Wrapmap link, looks like that could be useful.
The gradient solution works... but you need something a bit more complicated than a two-colors linear gradient. The attached gradient starts with a foreground-to-background segment, but continues with a background-to-background segment, so the visual gradient remains along the border:

[attachment=898]

By "selection" to you mean the selected pixels or the selection mask? For selected pixels, put them on their own layer ("Edit/copy" and "Edit/paste as new layer"), and then use the Scale (Scale) and Align tool (Align) to scale and align the layer. For the selection mask, create layer, bucket-fill selection, autocrop layer, scale/align layer as above, and alpha-to-selection. You can also scale/love the selection directly using the Scale and Move tool in "selection" mode (red square in top row of tool options). And don't forget snap-on guides.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 25, 2012, 11:58
Post: #5
RE: Gradient - Blend Along a Rounded Corner?
Come to think of it, in many cases there is a solution that doesn't involve a specially designed gradient. When you use a plain black-to-white gradient, the pixel RGB values are a direct function of the position of the pixel. The "Levels" and, more graphically, the "Curves" tool are merely establishing a mapping from input value to output values. Since the gradient is mapping position to values, applying gradient then curve lets you map positions to arbitrary values. For instance to make a double border inside an arbitrary shape:

[attachment=899]

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 29, 2012, 11:38
Post: #6
RE: Gradient - Blend Along a Rounded Corner?
(Jan 25, 2012 11:58)ofnuts Wrote:  Come to think of it, in many cases there is a solution that doesn't involve a specially designed gradient. When you use a plain black-to-white gradient, the pixel RGB values are a direct function of the position of the pixel. The "Levels" and, more graphically, the "Curves" tool are merely establishing a mapping from input value to output values. Since the gradient is mapping position to values, applying gradient then curve lets you map positions to arbitrary values. For instance to make a double border inside an arbitrary shape:

Don't really understand any of that, hehe. Thanks anyway. Looks like I have a lot to learn.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  how to blend straight edges into background?? kshaeblue21 1 167 Aug 11, 2017 03:30
Last Post: ythgilb
  [SOLVED]Weighted Blend in GEGL library mIXpRo 2 240 Oct 6, 2014 07:47
Last Post: mIXpRo
  Twitter logo on top of outline of Africa with color gradient tommycarstensen 1 477 Jun 23, 2014 07:37
Last Post: ofnuts
Information Gradient Text Looks Sharp Softly 1 278 May 19, 2014 07:05
Last Post: ofnuts
  How to fill a ractangle area with a gradient that fits it Darker 3 454 Apr 12, 2014 14:32
Last Post: ofnuts

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS