LodePaint User Manual

Back to main page

Mask

About

LodePaint offers the mask feature to let filters have effect on only a part of a painting. A mask is similar to for example a selection of arbitrary shape with arbitrary opacity of "feather". However LodePaint offers no such selections, it offers the mask feature instead. LodePaint offers selections too, but a selection can only be rectangular because selections in LodePaint are programmed as simple rectangular images or areas, similar to how a complete image is always rectangular.

Usage

The mask can be toggled "on" or "off" on an image. To toggle the state of the mask, use the "Toggle Mask" button in the toolbar.

The mask only has an effect when it's on. When the mask is on, it's drawn with a certain color over the image. Areas through which you can see more, are affected more by filters while the mask is on. If the mask is off, then everything is affected by filters (that is the normal case). When first enabled, the mask is completely "full", meaning nothing at all of the image will be affected by filters. To enable certain parts, you need to change the mask to open certain areas of it. For that, tools and menu actions are available.

You can still see slightly through the most opaque areas of the mask, so that it's possible to recognise the full image behind it.

The color with which the mask is displayed, can be changed with the "Mask Display Color" button in the toolbar. This is useful if the image already has many colors similar to that of the mask, in which case it'll be hard to distinguish the image and the mask. This color has no influence whatsoever on the calculations with the mask, it's only a display color.

When on, the mask blocks part of the image. Blocked parts of the image will not be affected by filters. Partially blocked parts of the image are partially affected by filters. This works for all filters in LodePaint that don't resize the image. For filters that do resize the image, the mask has no effect and the mask is reset after the resize. The mask works for example for such filters as Negate RGB, change hue, blur, greyscale, generate noise, ... It also works for some transformation filters (as long as they don't change the size of the image) such as flip X, flip Y, rotate 180 degrees, ...

Tools

Edit Mask Brush

This looks like a red square with a gap in the toolbox. The Edit Mask Brush Tool is very similar to the regular Brush tool, except with it you affect the mask instead of the image. With the left mouse button, the mask made more leave-through at that location. With the right, it is made more blocking.

The Alpha Left and Alpha Right sliders change what the left and right mouse button do. 0 means "leave-through", 255 means "blocking", anything in between is partial blocking.

Magic Wand

This tool is very similar to the magic wand tool that operates on selections in many painting programs, but here it operates on the mask instead of on the selection. Like all mask-related tools, you can see the effect of this tool only if the mask is toggled on. With this tool, click somewhere on the image, and all areas in the images with similar color around the mouse, will become "see-through" in the mask. The tolerance setting affects how much colors are affected.

Actions

In the Image / Mask menu, several filters (called "actions" here to not confuse them with filters that work on the image data instead of on the mask) for the mask are available.

Clear Mask

This makes the mask fully opaque again. This means the mask blocks everything.

Feather Mask

This applies a gaussian blur to the mask, so that the edges are more soft.

Invert Mask

Inverts the mask, so blocking parts become leave-through parts and vice-versa.

Selection To Mask

Adds the selection to the mask. It does by making all pixels inside the location where the selection rectangle is, leave-through.

Alpha To Mask

Multiplies the alpha channel of the image with the mask and stores the result into the mask. To convert the alpha channel of the image in the mask without the multiply effect, first use "clear mask" to make the mask fully blocking, then use Alpha To Mask.

Swap Mask With Alpha

This swaps the mask with the alpha channel of the image. Repeating the operation twice in a row brings back the original situation.

Uses of this operation are:

*) Being able to edit the mask in a more complex way, by using tools and filters on the alpha channel and then swapping it with the mask.
*) Saving a temporary oritinal of the alpha channel of the image in the mask, when not using the mask for anything else.
*) Saving a temporary original of the mask in the alpha channel of the image, when not using the alpha channel for anything else.

Example

Here's a simple usage example of masks.

1) Top left: The original image
2) Top right: toggle the mask "on". The mask is initually fully blocking.
3) Center left: Draw on the mask with the "Edit Mask" brush to open up some parts.
4) Center right: Apply some filter on the image, in this case "Generate Noise" was chosen.
5) Bottom: toggle the mask "off" to see the result. The noise is added only where the mask was leave-through, and the sides of the area had a partial effect.

128-bit floating point color (HDR)

The mask currently only works for images with 32-bit RGBA (8 bits per channel) only. Support for the other color modes is planned for later.

Selection and Mask Interoperability

The selection system and the mask system are two independent systems. They both ignore each other. They are not designed to be used together. Using them together might result in some strange usage scenarios, that might be improved or made more intuitive in future versions of LodePaint.

Here's what selections and masks currently support in LodePaint. In an ideal scenario, the functionality of both masks and selections is merged in one system, but it was currently too hard to make LodePaint like that, hence the two independend systems. In the table below, "partial blocking" refers to the effect where, after doing a filter, some pixels of the image (where the mask partially blocks) are half-affected (or more or less), while non-partial blocking only allows pixels that are either fully affected, or not affected at all.

/ Selection Mask
Blocking filters Yes Yes
Blocking tools Not yet Not yet
Partial blocking No Yes
Other shapes than rectangle No Yes
Moving pixel contents and "floating" Yes No
Pasting to / copying from Yes No
Another difference between selections and masks is that when a filter is applied to a selection, only the pixels in the selection affect the filter. When a filter is applied to a mask that has the same shape as the selection, all pixels of the whole image can influence the result of the filter (even if only the pixels allowed by the mask are affected by the filter). This effect can for example be seen with filters such as Flip X/Y, Random Shuffle, Fourier Transform and Gaussian Blur.

In the future...

Masks are a work-in-progress feature in LodePaint. The following features are not supported yet by masks but are planned:

Legal Stuff

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Copyright (c) 2009-2010 by Lode Vandevenne.

Note: No images? Get the full manual at http://sourceforge.net/projects/lodepaint/files/LodePaint_Manual_Full.zip/download/. The full manual with images is released separately because the images filesize is larger than that of the program!