Nowadays every digital image editor or painting program has some basic support for layers, Krita is no exception. Krita supports layers which help to better control parts and elements of your painting.
Think of an artwork or collage made with various stacks of papers with some paper cut such that they show the paper beneath them while some hide what's beneath them. If you want to replace an element in the artwork you replace that piece of paper instead of drawing the entire thing. In Krita instead of papers we use Layers. Layers are part of the document which may or may not be transparent, they may be smaller or bigger than the document itself, they can arrange one above other, named and grouped.
Layers can give better control over your artwork for example you can recolor an entire artwork just by working on the separate color layer and thereby not destroying the line art which will reside above this color layer.
You can edit individual layers, you can even add special effects to them, like Layer styles, blending modes, transparency, filters and transforms. Krita takes all these layers in its layer stack, including the special effects and combines or composites together a final image. This is just one of the many digital image manipulation tricks that Krita has up it's sleeve!
Usually, when you put one paint layer on top of another, the upper paint layer will be fully visible, while the layer behind it will either be obscured, occluded or only partially visible.
The image above shows various types of layers in layer stack
In Krita visible layers form a composite image shown on the canvas. The order in which Krita composites the layer is from bottom to top, more like the stack of papers we discussed above. As we go on adding layer the composite changes according to the properties of the newly added layer on the top. Group Layers composite separately from the other layers in the stack except when pass through mode is activated. the layers inside a group form a composite image first and then this composite is taken into consideration while layer stack is composited to form a whole image. If the pass through mode is activate by pressing the icon similar to bricked wall, the layers within the group are considered as if they are outside of that particular group in the layer stack, however the visibility of the layers in a group depend upon the visibility of the group.
The groups in a psd file saved from photoshop have pass-through mode on by default unless they are specifically set with other blending modes.
There is a clipping feature in Krita called inherit alpha. It is denoted by an alpha icon in the layer stack.
It can be somewhat hard to figure out how the inherit alpha feature works in Krita for the first time. Once you click on the inherit alpha icon on the layer stack the the pixels of the layer you are painting are confined to the combined pixels of all the layers below it. That means if you have the default white back ground layer as first layer clicking on inherit alpha icon and painting on any layer above will seem to have no effect as the entire canvas is filled with white. Hence it is advised to put the base layer that you want the pixels to clip in a group layer. As mentioned above group layers are composited separately hence the layer which is the lowest layer in a group becomes the bounding layer and the content of the layers above this layer clips to it if the inherit alpha is enabled
You can also enable alpha inheritance to a group layer.
You can know more about inherit alpha in this Tutorial.
Krita supports non-destructive editing of the content of the layer. Non-destructive editing means editing or changing a layer or image without actually changing the original source image permanently, the changes are just added as filters or masks over the original image while keeping it intact, this helps a lot when your workflow requires constant back and forth. You can go back to original image with a click of a button, Just hide the filter or mask you have your initial image.
You can add various filters to a layer with Filter mask, or add Filter layer which will affect the whole image. You can transform the layers non-destructively by adding Transform masks , You can also hide portions of the layer by adding a Transparency mask instead of permanently erasing it and if you change your mind you can un-hide this portion later at any point.
These filters and masks are accessible through the right click menu (as shown in the image below) and the Plus icon on the layer docker.
You can also add a filter as a mask from filter dialog itself, by clicking on the Create Filter Mask button.
All the filters and masks can also be applied over a group too, thus making it easy to non-destructively edit multiple layers at once.
In next sections you can read more about the individual types of layers and masks.