To change the color of part of an image in Krita, follow the following steps:
1: open the image you want to edit in Krita.
2: select the part of the image that you want to modify.
3: add a new non-destructive filter with a filter layer by clicking on the down arrow button next to the add layer button in the "Layers" docker. When we add a new filter layer with a selected area active, the selected area automatically becomes part of the internal mask of the filter layer.
There are several filters that we can use to change the color.
In this tutorial, we're going to use Adjust -> HSV/HSL Adjustment, because it lets you change the hue of the image; presumably that's what most people want.
The new filter layer dialog has a list-detail layout. Once you select Adjust -> HSV/HSL Adjustment in the list pane at the left, the settings for the filter should appear in the detail pane at the right.
5: the first thing you see in Adjust -> HSV/HSL Adjustment is a dropdown list button that lets you selected the type of adjustment. Its default setting is Hue/Saturation/Value. Change it to Hue/Saturation/Luma.
Tip: another good option for photography is Blue Chroma/Red Chroma/Luma. We'll learn more why later.
6: click on the hue bar to adjust the color of the image. Hue is measured absolutely from 0 to 360 degrees. Since this filter changes the hue relative to the current hue, the values range -180 degrees to 180 degrees.
7: click the "OK" button to finish applying the filter.
8: save the image.
Other Filters
Other filters in Krita that are capable of changing the color of the image are:
- Adjust -> Color Balance lets you change the cyan, yellow, and magenta balance of colors in the shadows, midtones, and highlights separately.
- Adjust -> Desature has the best method to make an image grayscale(How to Make a Photo Grayscale in Krita?).
- Adjust -> HSV/HSL Adjustment provides multiple ways to reinterpret the color values of the pixels, such as hue, saturation, value or luma, and change them.
- Adjust -> Invert inverts the color values of the pixels.
- Adjust -> Levels can be configured to let you change the values of color channels separately.
- Adjust -> Color Adjustment (a.k.a. "curves") can be configured to let you change the values of color channels separately as well. This is a good method to change the brightness and contrast of the image in Krita.
Tip: if you aren't satisfied with the results of this filter, you can simply hide the filter layer in the "Layers" docker and create a new filter layer to try another method, and then switch which filter layer is visible to compare the results.
Why Luma?
Krita provides the following "types" of adjustments for the HSV/HSL Adjustment filter:
- Hue/Saturation/Value.
- Hue/Saturation/Lightness.
- Hue/Saturation/Intensity.
- Hue/Saturation/Luma.
- Blue Chroma/Red Chroma/Luma.
In most cases, an image format will be RGB. This means each pixel has 3 color channels: red, green, and blue. When these 3 are combined, we get colors from black to white, and everything between. Note that there is no "hue" channel or "saturation" channel.
In general, hue, saturation, and value (HSV), or hue, saturation, and lightness (HSL), are calculated from the RGB values. So when the computer shows you HSV parameters, it's showing you the result of a calculation done on the RGB data that is actually stored in the image.
This means that when you change the HSV values, those modifications can't be stored directly in the image either, because the image only contains data in the RGB format. So the computer has to perform the reverse calculation to transform HSV back into RGB. The same is true for HSL, etc.
Note: in 8 bits per pixel per channel, R, G, and B range from 0 to 255, so 100% red, or "1.0" red, is the same as 255 for 8-bit red.
In all methods, hue is a measurement from 0 to 360 degrees, where pure red (255, 0, 0 RGB), pure green, an d pure blue are 0, 120, and 240 degrees, respectively. Purple and pink are higher than 240 degrees, but it "loops back" to red when it reaches 360 degrees, like a circle.
They also all use the same method to calculate saturation.
However, the third component, whether value, lightness, intensity, or luma, is calculated differently depending on the method.
HSV | 100% value. |
HSL | 50% lightness. |
HSI | 33% intensity. |
Luma | 29.9% luma. |
We can guess why these values are what they are. Value is 100% because one component (RGB) is at 100% of its maximum value. Lightness is 50% because pure red is perfectly in the middle between pure black and pure white. Intensity is 33% because if we add the components together 255 + 0 + 0 = 255
, and divide by the maximum 255 + 255 + 255 = 765
we're going to get one third because only one component is at its maximum. But what is luma?
Luma is what we want to use for photography.
The first three methods do not care about the actual color of the pixel. Pure red (255, 0, 0), pure green (0, 255, 0) and pure blue (0, 0, 255) will always yield the exact same value, lightness, and intensity values: 100%, 50%, and 33%.
Luma, on the other hand, gives 29.9% luma for pure red, 58.7% luma for pure green, and 11.4% luma for pure blue. If we add these numbers, together 29.9 + 58.7 + 11.4 = 100%
. In other words, a white color will have 100% luma, but the amount of blue, red, and green contribute to different amounts of luma.
The reason for this is that these different colors is light being emitted at different wavelengths, and human being are sensitive to these different wavelengths in different ways. Although in the computer the pixel data is in RGB from 0 to 255, that doesn't mean our eyes work the same way. For our eyes, the green of the computer always looks brighter and the blue always looks darker.
Luma takes in consideration perceptual color. If we change the "hue" of a green image to a blue image, for example, most methods will produce a perceptually darker image even though the sum of the RGB components should stay the same. With luma, if we change the hue but don't change the luma, the computer will have to produce a RGB color of different hue with the same perceptual brightness than the original color.
If you take pure red (255, 0, 0) and change the hue to 120 or 240, the other adjustment methods will give you pure green (0, 255, 0) and pure blue (0, 0, 255), but with the luma adjustment you get dark green (130, 0, 0) and light blue (53, 53, 255).
Tip: in Krita, you can use the Settings -> Dockers -> Specific Color Selector to see the values for yourself.
Non-Rotational Hue
Most adjustment methods use relative hue degrees. This means that whatever is the current hue of a pixel, it gets "shifted" to one side or the other. Although this works pretty well in some cases, it does have a huge disadvantage. If you want to change the color of something that changes in color subtly, it will rotate ALL colors toward the same direction by the same amount.
For example, if something is red and yellow, and you turn red into blue, the yellow will turn into purple.
There are two ways to fix this.
The simplest method is to use the "colorize" option on the adjustment settings. This will make all pixels the same hue. One disadvantage of this is that making everything exactly the same hue can look a bit unnatural. You may be able to fix this a little by decreasing the opacity of the filter layer.
Another method is to use Blue Chroma/Red Chroma/Luma. This doesn't have hue and saturation, instead we get blue chroma and red chroma. The idea is essentially the same: green contributes the most amount when we calculate luma, so in this method, the green is "built into" the luma, and when red and blue chromas are negative, the only thing left is green.
Tip: in Krita it's possible to change the color space of the image from RGB to LAB or YCbCr through Image -> Convert Image Color Space.... When an image uses these color spaces, the pixel data doesn't have RGB values, but L, a, b values, or Y, Cb, Cr values. In both cases, one component is the luma while the other two are the chroma. If you're doing a lot of color work on an image, it's a good idea to use this color space instead. Note that changing color spaces is a destructive action: you shouldn't change from one color space to the other over and over again, pick one color space and work with it until you need to export the image.
Leave a Reply