This topic will show how to set up luminosity masks in an easy and resource friendly way using Krita.
If you are used to another piece of software you need to figure out if certain ways of working and techniques (in general or software specific) can be done using the alternative software. Not being able to use a specific technique might be reason not to use this piece of software (at all or for specific cases).
I’m already past the ‘Is Krita good enough for images?’ stage and am now in the process of switching from GIMP to Krita to do final stage retouching and editing.
One of the things I tend to use regularly are multiple selections that I can target individually. There’s an example of that I posted here on pixls, done in GIMP: Faux balconies in B&W. If I remember correctly I used about 20 selections for this one.
While looking into selections, specifically how to save them (GIMP’s Save to Channel equivalent) I came across Krita’s Local Selection option. This makes it possible to add one or more selections to a specific layer(s) and/or group(s).
I also came across the Select from Color Range... option in the Select tab. This one doesn’t just use colours though, you can also use Highlights, Midtones or Shadows as your target. The real power lies in the fact that you can set/create specific ranges and add or subtract them from what’s already selected (if anything).
It wasn’t until later that I realized that these two combined could be used to create luminosity masks. And although I don’t use it often I have in the past and knowing that this is possible in Krita would be rather welcome.
OK, enough of the intro, lets get to the actual how-to and create 1 layer (the image), 7 selections (the luminosity masks) and a few Filter Masks.
This was done using Krita 4.4.3, but the initial searches and experiments started when I used version 4.4.2. I’m not sure if all the below functionality was available before these versions (I do think all is covered in at least version 4.0.0 and onward though).
Krita’s layout shown in the below examples aren’t the default, they are mine, but this should not in any way hinder the instructions given.
- Load an image (example images can be found at the bottom of this topic).
First we grab the darkest parts, this will become the DDD mask:
- Open the Select from Color Range... window: Select → Select from Color Range...
- Set target to Shadows (default is Reds), set Fuziness to 33 (right click to set it manually) and click on Select. A small sections should now show the marching ants.
Click on OK to finalize this action.
- Make sure that the image layer (called background in the example file) is selected and right click on it. From the menus select Add and then Local Selection. Alternatively you can user the little arrow next to the icon with the square and plus inside it ( ) and select Local Selection.
- Select the entry called Selection 1, press F2 and rename it to DDD
Grabbing the some what lesser darker parts, the DD mask:
- The current Local Selection is turned on and it needs to be turned off before we can continue: Click on the white star ( ). It should be greyed out now and the selection mask (red part) is now gone.
- Make sure that the image layer (‘background’) is selected,
- Open the Select from Color Range... window
- Set target to Shadows, set Fuzziness to 66 and click on Select.
We need to exclude (subtract) the part from the selection that was already covered in the previous step:
- Set Fuzziness to 33, tick Invert and tick Subtract from current selection and then click on Select.
Click on OK to finalize.
- Select the image layer, right click on it and from the menus select Add and then Local Selection
- Select the entry called Selection 2, press F2 and rename it to DD
Grabbing the lightest darker parts, the D mask:
- Turn Local Selection off: Click on the white star.
- Make sure that the image layer is selected
- Open the Select from Color Range... window
- Set target to Shadows, set Fuzziness to 100 and click on Select.
- Set Fuzziness to 66, tick Invert, tick Subtract from current selection, click on Select and the on OK.
- Select the image layer, right click on it and from the menus select Add and then Local Selection
- Select the entry called Selection 3, press F2 and rename it to D
All the Shadow related Local Selections (masks) have now been created. You can check to see if all went well by turning the individual Local Selections on/off. As shown here:
I make just one selection for the mid-tones (the M layer). The default setting (fuzziness 100) is rather large and overlaps both with the Shadows and the highlights. Using 29 will select the section that is left open after setting up both the shadows and highlights selections.
See the Q&A section for some extra information concerning the creation of multiple mid-tone sections.
The mid-tones, the M mask:
- Turn Local Selection off if one is turned on.
- Make sure that the image layer is selected
- Open the Select from Color Range... window
- Set target to Midtones, set Fuzziness to 29 and click on Select and then on OK
- Make sure that the image layer is selected, right click on it, select Add and then Local Selection
- Select the entry called Selection 4, press F2 and rename it to M
Creating the highlight selections. First the brightest parts, the LLL mask:
- Turn Local Selection off if one is turned on.
- Make sure that the image layer is selected
- Open the Select from Color Range... window
- Set target to Highlights, set Fuzziness to 33 and click on Select and then on OK
- Make sure that the image layer is selected, right click on it, select Add and then Local Selection
- Select the entry called Selection 5, press F2 and rename it to LLL
And a little less bright, the LL mask:
- Turn Local Selection off if one is turned on.
- Make sure that the image layer is selected
- Open the Select from Color Range... window
- Set target to Highlights, set Fuzziness to 66 and click on Select and then on OK
- Set Fuzziness to 33, tick Invert, select Subtract from current selection, click on Select and then OK
- Make sure that the image layer is selected, right click on it, select Add and then Local Selection
- Select the entry called Selection 6, press F2 and rename it to LL
- With the LL mask selected press on the Move layer or mask down icon
The last and least bright of the highlight selections (the L mask):
- Turn Local Selection off if one is turned on.
- Make sure that the image layer is selected
- Open the Select from Color Range... window
- Set target to Highlights, set Fuzziness to 100 and click on Select and then on OK
- Set Fuzziness to 66, tick Invert, select Subtract from current selection, click on Select and then OK
- Make sure that the image layer is selected, right click on it, select Add and then Local Selection
- Select the entry called Selection 7, press F2 and rename it to L
- With the LL mask selected press on the Move layer or mask down icon twice.
All seven layers have now been created and are ready to be used.
Having a masking framework is nice and all but how do you make use of all this?
- There’s only one layer in this example, but make sure it is selected.
- Turn on the M mask using the star icon (do not select it though).
- Select a Filter Mask: Filter, Adjust then Levels. Adjust the levels to your liking and click on Create Filter Mask
A new entry has been added and automatically selected in the layers docker called Levels
Press F2 and rename it to M Levels. I would also move it to just below the M mask.
NOTE: There is a big difference between using Create Filter Mask or pressing OK when you are done with adjusting the Filter Mask. Pressing OK results in a one time, destructive action, Create Filter Mask on the other hand makes an entry that is accessible at any time and thus can be used to make changes later on if needed.
Lets add another Filter Mask, this one to the LL mask.
- Select the image layer
- Turn on the LL mask
- Select a Filter Mask: Filter, Adjust then HSV Adjustments. Select Colorize and turn up the Saturation slider. Click on Create Filter Mask when done.
- Rename it and move it to below the LL mask.
You are not limited to 1 Filter Mask per Local Selection, you can add as many as you like/need.
- Select the image layer
- Turn on the M mask
- Select a Filter Mask: Filter, Adjust then HSV Adjustments. Select Colorize and turn up the Saturation slider. Click on Create Filter Mask when done.
- Rename, and move below the M mask.
At any point in time you can change the settings for the Filter Masks as follows:
- Select the Filter Mask that needs to be changed (M Levels in this case) and press F3 (or right click on the Filter Mask and select Properties). You’re presented with a window that allows you to change the settings made.
Here’s a short video showing the last 12 steps, with also an alternative way to select a Filter Mask. As you can see you don’t need to turn off a Local Selection if you want to adjust a Filter Mask that is not associated with it:
One last thing; You can still make global adjustments on the image even though there are multiple Local Selections present. If you do not turn on a Local Selection (everything is off) and select the image layer you can add/apply any Filter Mask, globally to the image and all the other local changes will also be applied.
Q&A section
- Does it take long to set all this up?
Nope. The above framework looks like a lot of work, but it can be done in a few minutes.
- Are the numbers/ranges used special in any way?
No, they are not. But…
I used these as a starting point because they are convenient. Fuzziness 100 is the default setting when using Select from Color Range... and I evenly divided that three ways to get to 33 and 66.
You do need to make sure that the total luminosity range is covered if you change the numbers! If both the highlights and shadows section use the same range (0-100 in this case) it is relatively easy to figure out what the range needs to be for the mid-tones (0-29 in this case).
If you want to experiment yourself I would suggest you first set the mid-tone range and than make the highlights/shadows section fit that range. I also would strongly advise to create an image like the one I used in this how-to if you want to create a better/different/personalized version.
Setting up a different spread using a real life image is impossible. Once you have figured out the numbers you can blindly apply them to real images.
Here’s another way of dividing the shadows, mid-tones and highlights:
Highlights: 0-80
Midtones 0-55
Shadows 0-75
This setup gives you more room in the mid-tones and both the shadows and highlights are thus pushed outward a bit. Dividing them in 2,3 or 4 sections each should be easy with the above steps.
- Why am I not able to create multiple mid-tone sections using add, subtract and invert as described above?
Adding and subtracting using the mid-tones sections does not work the same as for the shadows or highlights. The shadows work from left to right, the highlights from right to left and the mid-tones start in the middle. This means that selections are determined from the middle outwards (to both sides at the same time).
Some creativity is needed to make multiple mid-tone sections:
Assuming the example given in the previous question and there being a mid-tones gap of 55 which you want to divide this into 2 sections:
creating the ML mask
- first create the full mid-tone section using 55 (see steps 20-25). This will select the complete mid-tone range,
- switch from Midtones to Shadow, tick invert, tick Subtract from current selection, set Fuzziness to 125 and click on Select and OK This created the mask for the mid-tones on the highlight side.
creating the MD mask
- again create the full mid-tone section using 55. This will select the complete mid-tone range,
- switch from Midtones to Highlights, tick invert, tick Subtract from current selection, set Fuzziness to 135 and click on Select and OK This created the mask for the mid-tones on the shadows side.
You might need to fiddle with the numbers (125 and 135) a bit to get it to your liking, but the above describes the way to approach the issue of creating multiple mid-tone selections.
There’s an alternative: Only use the shadows and highlight sections and use values larger than 100. Name the ones above 100 MD, M and ML (or MMM, MM, M or whatever you prefer). In the end it is about the masks that need to be created, not necessarily which tool section that is being used.
- Can the Local Selections be changed once they are created?
Yes, I said cautiously…
As long as there are no Filter Masks that use that specific Local Selection they can be changed without any problems. So adding, subtracting,growing,shrinking and/or feathering can be done afterwards if wanted/needed.
Things become a bit more complicated once a Filter Mask is applied using a Local Selection. The Filter Mask is set up using the mask from the Local Selection in question and it will not have any knowledge about the changed Local Selection once it is set up. It isn’t attached to it, but rather uses the info from the Local Selection.
So if, for example, you decide the mid-tones do need to have 2 sections (MD and ML instead of M) you need to delete the associated filter mask(s) first.
- Are there downsides to this method of doing it?
Maybe, it depends…
Yes if you are not very organized when setting this up. Appropriately naming your Local Selections and, more importantly, the Filter Masks that go with those selections is a must. I personally move the Filter Masks below the Selection they belong to for extra clarity (as shown in the above steps).
I have not found an easy, at first glance way to determine which Filter Mask is linked to which Local Selection. You can hover over the Filter Mask or Local Selection and Krita will show some basic information in a pup-up window. Among that is the mask itself.
- Are there alternative ways of doing this?
Yes. @Reptorian created a tutorial early last year: Pat David Luminosity Mask for Krita 4.3 Tutorial.
It is a bit convoluted. Here’s a quote from that tutorial:
[…] so I made a tutorial. It’s far more convoluted than on GIMP or Photoshop, but most certainly possible. I tried to make it as simple as possible even though it’s hard to follow along.
I do recommend having a good look at it though, it uses some nice Krita features, Clone Layers to name one, and shows that intricate/complicated things can be done with Krita.
- Can this be scripted?
Yes. For those that are Python savvy and don’t mind going through some on-line documentation: Just about everything can be scripted in Krita.
As of version 4.4.0 Python Scripting is available. This includes a simple programming interface (Tools → Scripts → Scripter). Links to the Krita APIs are to be found in the above mentioned link.
- The image I used for this how-to: grey scale 32 patches [tif 135 KiB]
- The final project file: Luminosity Masks [kra 1.69 MiB]
- The image I used for the alternative: Alternative division, 48 patches [tif 174 KiB]
- The alternative (L80/M55/D75) baseline file: Alternative division [kra 1.00 MiB]
License: CC BY-NC-SA 4.0