JavaScript support is required to run this website properly.
Please enable it in your browser's settings, or turn off the script blocker.

Documentation / Working with Layers and Masks


HDR photo tone mapping is all about local operators that work differently in various parts of the image, therefore doing the right job compressing large scale contrasts. However, the certain algorithm parameters may do great work in some parts of the photo, while not performing well in other areas, or even spoiling them (for example by causing halo effect, or bringing up too much noise). You can of course resign from aggressive processing and strike the right balance with the milder parameters, but wouldn't it be better to split the image into parts using masks and process them using different tone mapping settings in several layers that blend nicely? Such an approach requires some manual work, but it is worth it. Normally you could process the image several times, differently with easyHDR and do the masking and blending in Photoshop, but easyHDR's layers let you do it within easyHDR, which additionally gives you real-time preview of how the various parts fit together.

The most common use case may be a landscape view, where you can differently process the sky and the ground. However, masking may also be useful to differently treat a window view in an interior shot (useful in real-estate photography), or to selectively apply various effects, like color balancing, sharpening, etc.


Using layers in easyHDR

In order to use the layers in easyHDR just select: Layers in the main menu or click the "Enable layers" icon in the toolbox. The Layers tool will appear. It takes a bit of the workspace, but it can be minimized by clicking the bottom bar. The left part of the tool is where the mask painting and the visibility options can be found. The remaining part is for the layers selection, where the individual layers are shown in form of black & white mask thumbnails. To add a layer, simply hit "Add". To remove, please use an option in item's popup menu. Each layer can be blended with the rest with user defined opacity, which can be edited with a slider that appears once the mouse cursor hovers over the item.

Layers tool in easyHDR
Left side: layer painting and view options.
Right side: layer items with mask thumbnails. Popup menu with additional options for each layer.

When you create layers and paint masks for them, the base layer's mask will always be the remainder - what is not masked by all the other layers. Painting the mask on a layer can be done using three tools - flood fill, brush and a gradient tool. Each of them can work in "intelligent" mode, which can be controlled with the threshold parameter. The mask is then stronger for pixels more similar, depending on the used tool, to the flood fill click point, brush stroke origin, or gradient's source (which can be independently moved with a mouse to any place on the image). The tool can be controlled with a couple of useful shortcuts.

All the mask modifications can be undone or redone with Ctrl+Z, Ctrl+Y, or by choosing items from the "History" (see the tab in the left panel). The viewing options let you choose how the mask is shown - its overlay color, or whether it shall be shown as a black & white map, or maybe it shall not be visible at all. The latter mode allows live view of the result, while you paint the mask, or modify the gradient.


Flood fill

The flood fill tool allows painting the mask over the entire image. It is not filling closed areas of similar colors as typical paint bucket tools in image editors. When the "intelligent" mode is off it's less useful, because then it sets entire layer with a solid mask, but when it is on, the tool paints areas similar to the click point. It can be used several times in an additive way, or when Ctrl/Cmd key is held, to subtract from the current mask. You can for example select all shadows, or highlights and treat them with different tone mapping or color grading settings.

Mask painted with flood fill tool
Mask painted with flood fill tool. Threshold value set to middle. The sampling point is marked with an arrow.

Brush

The brush is for manual work. The style (base size, shape and feathering) can be selected from the drop down menu and the brush opacity with a slider next to it. The once selected brush stays the same size in respect of the screen, but changes its image relative size along with the zoom. To paint big areas, just select a larger brush style and zoom out the image to see all of it in the workspace. To work on fine details, just zoom in. Erasing can be done with an erase tool, but you can also force it painting with the brush and holding Ctrl/Cmd key. Try to find the right "intelligent" mode threshold and stroke start point that ensures the brush paints what you expect. If the other, unwanted areas are painted too, just iteratively erase them.

Painting with a brush
Painting with a brush.

Gradient tool

The gradient tool allows the simplest and most effective way of creating masks for photos with two distinct areas, like sky and ground. To use it just draw a line by clicking and holding mouse button and moving the cursor. The line is perpendicular to the gradient. The line's start point (white circle with a black dot inside) is where the solid mask ends and the gradient starts. The other end of the line is where the gradient ends. The samller white circle on the line is for controlling the middle point. When the "intelligent" mode is on, the movable sampling point is also shown.

While the gradient is being modified with the control points, you can turn off the mask's visibility and see how it affects the result (make sure the layer's tone mapping settings are different than for the other layers, or the base image). Once you're happy with the shape of the gradient, you need to apply it by pressing Enter or clicking the "Apply gradient" button on the workspace. To cancel, just switch tools, or press Esc.

Gradient painting
Gradient painting tool in action.

Sample use of the layers

For both of the examples shown blow a gradient tool has been used to paint the sky's mask. Then some brush manual work was done to either erase areas painted with gradient or add/strengthen mask where it was needed, but the gradient did not cover the area properly.

Tone mapping parameters optimized for the sky
Entire image processed with tone mapping settings #1 (optimized for the sky).
Tone mapping parameters optimized for the ground
Entire image processed with settings #2 (optimized for the ground).
Mask overlay (green) Mask for the sky, shown as green overlay.
HDR photo processed with two different tone mapping settings sets for two layers, sky and the ground.
Blended result, sky processed with settings #1 and ground with #2.

Tone mapping parameters optimized for the sky
Entire image processed with tone mapping settings #1 (optimized for the sky).
Tone mapping parameters optimized for the ground
Entire image processed with settings #2 (optimized for the ground).
Mask overlay (green) Mask for the sky, shown as green overlay.
HDR photo processed with two different tone mapping settings sets for two layers, sky and the ground.
Blended result, sky processed with settings #1 and ground with #2.


Back to the main documentation page



Current easyHDR version
3.16.1   (March 15th 2023)