# [Gimp-user] Algebra help w/script

```(Stop reading now - This is your only warning)

Ok, I'm struggling on some algebra here for a Script-fu plug-in I'm working on.```
```
The plug-in is an automation of this rounded corners tutorial:
http://gug.sunsite.dk/tutorials/rounded-corners

Essentially, this tutorial blurs a black and white image w/90 degree corners,
and then applies levels to bring the blurred edges back to a tight curved edge
(i.e., the technique rounds all corners in a black/white image). The level
tool's black input slider and the white input slider must adjust in relation to
the blur radius, and that's where I'm stuck.

The tutorial uses levels 119 (black slider) and 135 (white slider), which works
fine for a blur radius of 20px.  However, to use a different blur radius (to
achieve greater/lesser rounding of corners), the black and white input sliders
must adjust appropriately.  For example, if I do a blur radius of only 10px,
111 (black) and 142 (white) give the desired result (i.e., a tight rounded
corner with all excess blur removed).

Now I did some manual sampling of different blur radius to see if I could find
a relation between the blur radius and the black/white slider settings.  My
results make what looks like a y=1/x^2 type graph, but it needs a little
tweaking.

Here's my data.
Radius  Black White diff (White - Black)
0      0   255  255
2     70   183  113
4     93   160  67
6    102   151  49
8    108   145  37
10   111   142  31
12   114   139  25
14   115   138  23
16   117   136  19
18   118   135  17
20   119   134  15
22   119   134  15
24   120   133  13
26   120   133  13
28   121   132  11
30   121   132  11
32   121   132  11
34   122   131  9
36   122   131  9
38   122   131  9
40   122   131  9
42   123   130  7
44   123   130  7
46   123   130  7
48   123   130  7
50   123   130  7
52   123   130  7
54   123   130  7
56   124   129  5
58   124   129  5
60   124   129  5
62   124   129  5
64   124   129  5
66   124   129  5
68   124   129  5
70   124   129  5
72   124   129  5
74   124   129  5
76   124   129  5
78   124   129  5
80   124   129  5
82   125   129  4
84   125   129  4
86   125   128  3
88   125   128  3
90   125   128  3

http://epierce.freeshell.org/gimp/selection_rounded_stats.gnumeric

Now if I can just figure out the relationship (i.e., equation) between the
radius (1st column) and the diff (4th column), that should be all I need to
determine what the black/white slider settings should be for all cases.  My