krita‘s Channels:Documentation and built-in plugin

Now I do some channel operations in krita. Then I read the relevant documentation

Channels

../../_images/Krita_Channels_Docker.png

The channel docker allows you to turn on and off the channels associated with the color space that you are using. Each channel has an enabled and disabled checkbox. You cannot edit individual layer channels from this docker.

Editing Channels

If you want to edit individual channels by their grayscale component, you will need to manually separate a layer. This can be done with a series of commands with the layer docker.

  1. Select the layer you want to break apart.
  2. Go to Image ‣ Separate Image.
  3. Select the following options and click OK:
  1. Source: Current Layer.
  2. Alpha Options: Create separate separation from alpha channel.
  3. Output to Grayscale, not color: unchecked.
  1. Hide your original layer.
  2. Select All of the new channel layers and put them in a group layer (Layer ‣ Quick Group).
  3. Select the Red layer and change the blending mode to “Copy Red” (these are in the Misc. category).
  4. Select the Green layer and change the blending mode to “Copy Green”.
  5. Select the Blue layer and change the blending mode to “Copy Blue” .
  6. Make sure the Alpha layer is at the bottom of the group.
  7. Enable Inherit Alpha for the Red, Green, and Blue layers.

Here is a video to see this process in Krita 3.0.

When working with editing channels, it can be easier to use the Isolate Layer feature to only see the channel. Right-click on the layer to find Isolate Layer.

The first mistake is reversed:
image

Then I can’t understand what is the use of “Inherit Alpha”. Isn’t the alpha channel composed of black, white and gray? Its alpha is 100%
image

The correct way is to convert the alpha channel into a transparency mask. Then create a new blank layer in the group (don’t need the original layer because it may be semi-transparent)
Although it is a transparency mask. We can still press “alt” to display separately
image

Then I noticed that krita has a built-in “channel to layer” plug-in, which has not been written into the document. It also has some problems:

  1. Cannot recognize the alpha channel
  2. “Grayscale” mode also uses “addition”, which looks weird
  3. After the two modes of cmyk are selected, krita will crash (only run successfully once)

My expectation for it is to add a rgba mode, in accordance with the approach mentioned on the first floor. Then, I hope it will not add so many entries in the “undo history”, but integrate it into one

Hi

Support of alpha channel has never been implemented for this plugin :slight_smile:
Need to take a look on it, this plugin was initialy made to learn how to code a plugin, and after it was embedded with Krita.

I never think about alpha channel.

Now you speak about, the thing might be to add a layer with alpha value (the extracted channel layers themselves don’t have alpha information - that’s how the plugin is designed to be)
Need to determinate which blending mode to apply to the alpha channel…

I have to take a look about about this…
=> pushed in my todo list

:thinking:
The Greyscale is just a basic conversion of a channel for which pixel value is 0-255 to white&black levels (that’s the goal of implemented greyscale method)

For RGB Greyscale levels and CMY Greyscale levels basically, it just use addition blending mode as it was colored layer.
For CMYK Greyscale levels, it use multiply blending mode as it was colored layer.

Which blending mode should be applied in this case?
Not sure there’s a mode for which final result will be better than another one, but if you have suggestion and take a look and apply it by default.

I’m not able to reproduce it on my side :confused:
On which system are you running Krita?
Which version?

Is it a systematical crash?
Does it occurs with Krita 4? or only with Krita 5?

Are your working on a particular document (ie: many layers) or for example on a single layer document the problem also occurs?

Did you made any actions between 2 plugin execution?
Crash occurs when opening plugin?
When applying result?

=> I need more detail about problem to be able to reproduce it and try to understand what happen

Grum999

I use krita5.0 on windows10. (But in my impression, when I was not going to the forum last year, I used cmyk mode and it crashed. At that time I can not report it, and then I forgot it until today)

Now I create a blank document. Then I draw a few strokes randomly. When I open the plug-in and switch to cmyk, krita will get stuck, and then close after a few seconds.(Yes, there is only one layer and no other operations)

I mentioned it at the top:

The correct way is to convert the alpha channel into a transparency mask. Then create a new blank layer in the group (don’t need the original layer because it may be semi-transparent)
Although it is a transparency mask. We can still press “alt” to display separately
image

The blending modes of the rgb channel are “Copy Red”, “Copy Green” and “Copy Blue”
Alpha uses a transparency mask. So that its final display is the same as the original layer
(There must be an opaque bottom layer)

What I want to express is what I mentioned above. But if you think it is necessary to have an rgb grayscale mode without alpha. I think it will be fine to change to NORMAL. Because rgb color uses addition to restore color images. But the addition of grayscale images feels useless…

Wait… you don’t need an opaque background layer. When “Copy” is enabled on the two channels above, the third one is the other channel by default. So we can do this:
group layer
red channel——Copy Red
blue channel——Copy Blue
green channel——Normal
alpha————Transparency mask

@Grum999 would it too much ask if there is the possibility to add other Color spaces split? I have a bunch of formulas open now with pigmento now if you can use them to split in other spaces. One of my interests would be to split in lab eventually and edit that information.

For documentation update, I think @wolthera worked on it for Krita 5, maybe this fix can be included?

Concerning plugins provided by default with Krita, I don’t know if they’re in documentation and if they should be in documentation :man_shrugging:


I wasn’t aware of this function.
Functionality is pretty similar than one provided by plugin.

But for questions related to this function and why documentation indicate to activate “inherit alpha”, I can’t help :slight_smile:


Ok just tested, problem occurs on Windows10, not on Linux.
That’s why I didn’t saw it.

Tested on a Krita 4.4.2 on windows (I don’t have older binaries) problem seems to be here from ages, so it’s not a regression specific to Krita 5.0
I have to investigate on this, that mean I’ll have to use Windows :cry:

Ok result sounds good, I wasn’t aware of these blending modes.

But what for CMY/CMYK decomposition?
There’s no blending mode “Copy Cyan”, …
A suggestion?


Problem is not formulas, but Python.

The very first version of plugin was working at byte level to extract/calculate corresponding channel color.
It was very slow, especially on big images.

Currently to be able to proceed in a fast way, the plugin manipulate color layers.

Example about how Red channel is extracted from a layer:

'process': [
        {
            'action' : 'duplicate',
            'value' : '@original'
        },
        {
            'action' : 'new',
            'value' : {
                        'type' : 'filllayer',
                        'color' :  QColor(Qt.blue)
                    }
        },
        {
            'action' : 'blending mode',
            'value' : 'inverse_subtract'
        },
        {
            'action' : 'merge down',
            'value' : None
        },
        {
            'action' : 'blending mode',
            'value' : 'add'
        }
    ]
}

I’m not sure it’s possible for example, to extract a L* channel from Lab* just by doing some layer manipulation… :thinking:

But if you have formulas that’s allow from a RGB value to get Lab value from (within range 0-255) I can take time to made a test.

Grum999

yes I do have that.
I just need to correct the values for xyz into lab to work more as expected and it is good but it is basically done already.
If you want I can send you a script later on how to convert it and the variables set already.

It is possible to extract L channel indirectly. In the layer property, one can disable channel. And then there is a convoluted approach with the use of cross-channel adjustment for other channel if you want them in grayscale. All that is needed is Replace Alpha blending mode, and L to alpha blending mode (as in being able to work in rgba) to have complete control over individual channels.

Sorry, I have not studied the cmyk mode…
Maybe there will be developers who will implement “Copy Cyan”

If it is more convenient, why not? I think it should be mentioned at least, because the original operation is too cumbersome

Hi,@Grum999
Half a year later, I operated on 5.0.2, and it won’t crash krita again!

I have also found a way to combine layers, but let me first say a problem: the operation result of CMY/CMYK grayscale is opposite to that in GMIC. After consideration, I think GMIC is more appropriate and correct. In grayscale images, white represents “more” and black represents “less” (mask, filter layer, etc.). This is the meaning of “representative”, not the meaning of “algorithm”.CMY / CMYK is a subtractive algorithm. The amount of white in the picture containing “cyan” should be “black”. This is more logical.



CMY / CMYK color I think is appropriate. It represents the color separated from the picture. The black part can decompose more colors, while the white part represents less. Although another filter in GMIC is the opposite, it uses a blending mode of “difference”. I don’t think so.

CMY grayscale
white layer【difference】
C 【copy red】
M【copy green】
Y【normal】
alpha 【Transparency mask】 
CMYK grayscale
K【multiply】
white layer【difference】
C 【copy red】
M【copy green】
Y【normal】
alpha 【Transparency mask】 

This is the result of the modified grayscale image. If you remain unchanged, you don’t need to add “white layer [difference]”.
舒服垫

Finally, if I can, let me say some feature requests:

  1. Add an alpha channel and process it according to “convert to Transparency mask”
  2. Add a “crop” option, which can automatically “trim to image size”
    image
  3. “Single channel” can be extracted, and if a channel is selected, it can also be loaded directly into the system clipboard
2 Likes

Hi

Thanks for feedback and time passed to search for better alternatives :slight_smile:

Currently not really active for miscellaneous reason, I have to confess this plugin is not in “top of the todo-list” :flushed:

I want to finish v0.7.0 of BuliCommander, that’s the plugin I use the most and after I have to work on BuliBrushSwitch for which improvement have also been requested and I also use a lot…

Concerning Channel2Layers I have ideas, but my ideas may need long time for implementation…

Grum999

1 Like