Did you ever wish you had a set of specialized blur, sharpen, or edge detect filters? Have you ever wanted an emboss filter that retains the colors of your original image? Maybe you yearned for a filter that would give you something kinda funky. If so, you should probably take a look at User Defined Filters.
Some people find User Defined Filters to be rather baffling, and so they never experiment with this handy feature. Other people experiment without really having any idea how User Defined Filters work, and often these folks give up when the only thing their filters seem to do is turn their images completely black or completely white. The technical discussion in the old PSP documentation was fine for what it is, but most of us would do better with some rules of thumb instead of an equation. That's what this tutorial will give you: several User Defined Filter (UDF) rules of thumb that involve only very simple arithmetic. (And PSP8 can even do the arithmetic for you!)
First, let's examine what you'd see if you selected Effects > User Defined. You'll then be presented with the User Defined Filter dialog:
(Note: In the matrix examples given in this tutorial, I've turned off the filter's preview windows. When working on your own filters, you'll undoubtedly want to keep the preview windows open.)
For now, ignore the Divisor and Bias, and pay attention only to the Filter Matrix. The center cell in the matrix corresponds to the pixel that the filter will affect. The surrounding cells correspond to the pixels surrounding the target pixel.
What you'll normally want to do (assuming that the Divisor is kept at 1 and the Bias at 0) is make sure that the sum of the values in all the cells in the matrix equals 1. This will ensure that the overall brightness of the filtered image is the same as the brightness of the original image. If the sum is less than 1, the filtered image will be darker than the original. If the sum is greater than 1, the filtered image will be brighter. Sometimes you'll want your filter to brighten or darken your images. But keep in mind that if you stray too far from 1, you'll get a filter that turns an image either entirely black or entirely white!
So here's our first rule of thumb:
Unless otherwise compensated for, keep the matrix sum at 1 to retain the brightness of the original image.
And here are two corollaries:
To brighten an image, make the matrix sum greater than 1.
To darken an image, make the matrix sum less than 1.
To see what otherwise compensated for in the first rule of thumb means, let's look at this simple filter:
Notice that here the sum of the matrix is 9: there are nine cells with values of 1, and adding together those values gives us a sum of 9. This sum is greater than 1 by a factor of 9, and we can compensate for that by making use of the Divisor. By specifying a Divisor of 9, we divide the sum of 9 by 9, which gives us a result of 1. (See, I told you the math would be simple!) And 1 is just what we need if we want the brightness of the original image to be maintained in the filtered image.
So here's our next rule of thumb:
To compensate for a sum that deviates from 1, use a Divisor equal to that sum to maintain the image brightness of the original image.
This will work whether your sum (and corresponding Divisor) is a positive value or a negative value. Keep in mind, too, that you can also use the Divisor to help adjust the brightness of your filtered image, by using a value that only partially compensates for the sum's deviation from 1.
In PSP 8, you don't even have to do the math to get the Divisor that equals the sum of the matrix values. Just press the Compute button and PSP will calculate the value for you and plunk it in as your Divisor.
The filter we just looked at also shows us how in general to get a blurring filter:
For a Blur filter, use a positive center value and surround it with a symmetrical pattern of other positive values.
In later tutorials we'll examine how to make sharpen, edge detection, and embossing filters, and how to use Bias. Before ending this tutorial, let's look at just one more example and rule of thumb:
Here we've taken our original blur filter and increased the center value to 15, giving us a sum of 23. We've compensated for the increased sum by specifying a Divisor of 23. This new blur filter lessens the effect of the original blur filter, as shown in these examples:
|Original||Blur - less||Blur|
This lessening of a filter's effect is something you can get with any UDF, not just with blurring filters. And it will work whether your center value is positive or negative. Here's the rule of thumb:
Lessen the effect of a filter by increasing the value in the center cell; compensate with the appropriate Divisor to maintain the brightness of the original image.
Experiment with your own selected values. Also try directional blurring: Arrange your peripheral values in a straight vertical, horizontal, or diagonal line passing through the center cell.
That's far from the last word on UDFs! But this basic tutorial should get you well on your way to discovering how to master and make use of User Defined Filters. And once you've tried a few blur filters, you might want to take a stab at Sharpening UDFs, too. (Sorry, I couldn't resist the pun!)
Lori J. Davis
All rights reserved