Creating masks with SF Maskerade

Masks can be used in various ways and very profitably, above all where the standard tools are not sufficient or bring insufficient results. But most programs (even professional) don't support the creation of masks quite well. Brightness and color selections and the appropriate masks can be created in each program rapidly (for instance with the Magic Wand), but selection criteria and boundary conditions (e.g. Tolerance and Soft Edge) often can hardly be controlled or not at all. Even in Photoshop, the creation of perfect edge masks requires numerous steps, and there exist no tools for creating saturation masks at all.

With SF Maskerade you can easily create not only masks of all types mentioned, but also control the criteria in a very fine-grained manner. Two controls permit the selection of lower and upper threshold values separately. Two other controls permit the adjustment of tolerances for both threshold values. The value range of the mask is visualized with a gray-tone or color gradient. Here the accurate borders are visible as narrow lines. The Photoshop option Soft Edge is realized here as the possibility of blurring the mask.

The following samples are only a small selection of possibilities. You can download all examples as a SimpelFilter parameter file and load the examples as variants in the SF Maskerade filter. This is possible with the Standard and demo version of SF Maskerade. Only the LE version of the filter is not suitable for loading parameters. In principle most of the examples should work with Maskerade LE, too.

Of course you can change and adapt all examples as you will and save them as your own variants in a new file. Note that the results of the filter adjustments depend on the image. The original image for the following examples is shown on the right. You may need to adjust settings with other images. Generally applies to masks: The manual rework with brush and other tools is not only permitted, but usually quite reasonable in order to remove too many or wrongly selected pixels. Naturally you can use the filter not only for creating masks but also for black-and-white effects. Some examples are shown below.

Load Variants

All eleven samples are stored as Variants in the file SF_Maskerade.SFF. You can download the file by clicking the file name with the right mouse button and by choosing "Save target as...". Afterwards, you can open the file in SF Maskerade.

Loading a single variant: In the filter dialogue, click onto the variant number which you want to overwrite, or activate a new variant, for example with SHIFT-click on a still grey variant or SHIFT + F-key. Press the key L or click the L button in the dialogue. A file selection box opens.

Loading all variants: Press SHIFT and L simultaneously or click the L button while the SHIFT key is pressed. A file selection box opens.

Sample images

You can download the left sample image by right-clicking the image and then chosing "Save image as...". Three further sample images (that I used in an article in the German c't-magazin 19/2006) you will find here. Please note that all images are saved in reduced scale and in the lossy JPEG format that have a unfavorable effect for the quality of the mask.

Creating layer masks

You can download a Photoshop action that creates the layer mask automatically per right-click on the following link:

SimpelFilter PS-Action

13 samples

Luminosity mask

(Variant 1)

With a luminosity mask you can control the brightness and contrast of an image accurately - for example lighten dark areas and darken bright areas of the image, without affecting the other areas in each case. For lightening under-exposed pictures the mask in these regions has to be permeable, that means white or bright.

Choose Mask: Brightness and Channel: Luminance. The bright image areas are already selected by default. Extend this range as desired (by moving the Range slider below the gray gradient to the left or by hitting SHIFT + right-click in the preview). The Tolerance should be quite low. You can get soft transitions between the masked and unmasked image areas by blurring with medium to high radii. Finally, the mask has to be inverted.

Flexible Threshold

(Variant 2)

The brightness mask is suited well for graphic effects. With a right mouse-click into the preview you can put the lower and upper threshold on the brightness of the clicked pixel. If you now minimize the tolerance, only pixels with this exact brightness remain white - all others become black. By increasing the selection range and different tolerance settings (clicking the = button decouples the tolerance sliders) you can obtain interesting combinations of gray tone images with hard black-and-white contrasts.

Color selection

(Variant 3)

With chosen Mask: Hue the gray gradient changes to a color gradient over the full color spectrum (color angle from 0° to 359°). You can now select a color range with the two range controls (or by SHIFT + right-click in the preview) very precisely. By default the full range is selected. Only in this mode you can move the sliders above one another for selecting for example red and magenta colors together. With the tolerance sliders you can adjust the hardness of the selection borders.

If you choose a specific hue in the second combobox, you can select the color range more precisely. You can choose Red, Green, Blue, Cyan, Magenta, Yellow. The picture on the right shows a sample with a red hue range..

Another mode (shown in variant 4) serves for selecting colorless (gray) areas of the image.

Mask as transparency

(Variant 3a)

Alternatively to a gray tone mask, all masks can be output as transparency of the current layer. Preconditioned that the filter is applied to a normal layer with transparency (no background layer). The adjoining example shows exactly the same settings as in variant 3, but the option mask->transparency is set. All masked colors became transparent and thus invisible. This procedure is suitable for fast isolation of objects which distinguish from their environment, and for composition and montage of layers.

Selecting gray tones

(Variant 4)

Among the gray tones are black, white and all gray tones which do not exceed a certain (setted with control Without B/W) saturation. The gray tone option is the last option in the color combobox. However, with the Range controls you select now not colors, but tonal values (i.e. brightnesses) of gray tones. All colored pixels and the gray tones that don't belong to the selected brightness range will be part of the mask, i.e. black.

A gray tone mask created this way is suitable for selective removing of color casts from certain brightness ranges of an image, for example. Please note that the Without B/W setting has to be greater than zero in this case.

Saturation mask

(Variant 5)

With Mask: Saturation you can select certain saturation regions - either of all colors or of one of the six basic colors red, green, blue, cyan, magenta, yellow. The example shows the selection of weakly saturated colors, whereby the unsaturated colors (left end of the gray gradient) are not included in the selection (thus masked). With this saturation mask the image colors can be intensified afterwards, without gray areas getting color casts and already highly saturated colors becoming over-saturated.

If you drag the lower range control completely to the left and the upper nearly to the left end, unsaturated colors - thus gray tones - are selected. The difference to the gray tone mask described above (variant 4) lies in the fact that no brightness range is selectable now. In addition, the result strongly depends on the saturation type you selected in the options dialogue. The default type is here Photoshop. If you select HSL or HSB, nearly white and/or nearly black colors are considered strongly saturated and will not be masked. Remedy offers the option Without B/W.

Saturation mask without gray tones

(Variant 6)

The option Without B/W always excludes colorless image areas from the selection, that is these are masked - thus black. In the accompanying example weakly saturated blue pixels were selected, particularly the sky, in order to make them more blue and stronger. Now the control Without B/W (depending on its value) excludes the nearly colorless pixels in the sky - for example a white cloud - from the selection. These pixels are masked and therefore protected from the following treatments.

The option Without B/W is also useful with some other masks, for example with the color selection. Black, gray and white ranges have a color, too, namely red (color angle 0°). Therefore they would be selected by default if you selected red colors, unless you choose a value >0 for Without B/W.

Edge mask

(Variant 7)

With Mask: Edge you select the edge contrast of the image. The result is an edge mask with white edges on a black background, as it is needed for example for professional image sharpening. The gray gradient changes in this mode to a divided gradient which symbolizes the contrast: Left lie the ranges of less, on the right lie the ranges of high edge contrast. With the Range controls you select a contrast range that should become completely white in the mask. The preset is a range from 64 to 255 tonal values. This adjustment corresponds exactly to the function of the Photoshop filter Find Edge (the mask is only inverted). With this setting, edge contrasts are increased up to four times which emphasizes the edges more clearly. If you wish a proportional transformation of the edge contrasts, drag the lower range control completely to the right.

The Range controls together with the Tolerance controls permit a very exact selection of the edges included. You can here - as in all other modes - specify the range with right mouse clicks in the preview while pressing SHIFT. The display in the dialogue always shows the current (maximum) edge contrast under the mouse pointer. Internally, the contrast in a 5x5 pixel field is measured. In order to receive accurate values, you should select a preview size of 100% or 200% - otherwise the values of the reduced preview image are measured, and these can deviate from the original values.

Channel selection plays a role for the edge mask, too. The edge contrasts usually differ depending upon which color channel is selected. Often the blue channel contains more noise than the other channels and therefore should not be selected. If maximum edge contrast is your primary goal, select Channel: All. In this case the filter automatically determines the highest edge contrast in the three color channels.

Blurring the edge mask

(Variant 8)

A slight softening of an edge mask belongs to the standard jobs which you can settle with the Maskerade filter too. Since blurring darkens the bright edges more or less strongly, turning on the option Auto Contrast is recommended here. Thus the contrast of the mask is increased until the brightest pixels are completely white and the darkest pixels are completely black. Note that this function depends on the brightness values of the preview image. If this shows only a section of the full image, the result can be different from that obtained from a preview image in full size. The final image is calculated correctly in either case.

Invert edge mask (line drawing)

(Variant 9)

The inverted edge mask is suitable as a mask for blurring the original image under protection of the edge sharpness, however it already represents an attractive image effect. With the Range and Tolerance sliders you can control very exactly whether only the rough outlines of the image or also the finer outlines appear as black lines on white background.

Contrast mask

(Variant 10)

The Contrast mode enhances the contrast between neighbour pixels. The filter searches in the neighbourhood of every pixel (depending on the Radius) for the highest contrast. Contrasts within the choosed range are enhanced to black/white contrast. Pixel outside this range are preserved (but converted to grey pixels). If Auto-Contrast is choosed this pixels are converted in a 50%-Grey. The result looks a little bit like a high pass filter.

In order to enhance smallest contrasts choose a minimal Radius and move the range sliders to the left end. Higher Radius is recommend for graphical effects.

Combining masks: Minimum

(Combination of Variant 1 and Variant 9)

All Variants can combined to a single mask. Combinations highly improve the possibilities of the Maskerade filter. They allow the creation of masks not possible to create any other way. For example, by combining blurring and hard contrasts you can create some unusual and appealing effects. In the sample file the combination of the Variants 1 and 9 is prepared. Beginning with version 3.2 the Maskerade filter supports seven blending combining modes and one cumulative mode.

Please turn on the Combination Mode by clicking in the check box and choose the mode you like in the list box. The combined Variants are colored red now. If one Variant is activated (the settings are shown and can be changed) it has a dark red color. You can switch between the Variants as you like and by clicking Alt you can add or subtract Variants to/from the combination.

In the Minimum combination mode (shown on the right) the masked, thus dark areas of the single variants prevail. The sample shows a combination of a blurred luminosity mask (Variant 1) with the "line drawing" (Variant 9). Both variants are applied to the original image and then combined to a single mask.

Combining masks: Cumulative

(Combination of Variant 1 and Variant 9)

In the Combination Mode Cumulative only the first selected variant is applied to the original image. All additional selected variants are applied (from left to right) to the result of the previous selected variant. In the sample variant 9 (line drawing) is applied to the result of variant 1 (luminance mask).