Use alpha channel in brush tips, or add an overlay tip

I’m trying to make brushes for vegetation (e.g. leaves), and it appears my only options for brush tips are to use color as mask, which appears to convert the value portion of the HSV of the image used into alpha, or I can just have the original color. The feature I’m proposing is an option to use alpha values in the image as the alpha, and preserve the value. This way I can have shading and outlines in the brush, but still choose the color. Currently, any shading in the image used to create the brush gets turned into alpha, which isn’t what I want.

If this is difficult (like it breaks compatibility for brush tip images), then an alternative method would be to add a brush on top, like the current masked brush, but that is an overlay instead of masking the brush. This way I can have the main brush tip be the color mask, and the other be a detail overlay. This would actually be the more versatile option, since it would allow the overlay to have different colors, rather than just modifying the value.

If the second option is taken, the overlay brush would need to be able to share the rotation, size, etc of the main brush, so you don’t get weird effects (though it could be interesting to leave that as an option).


Hello and welcome to the forum.

Could you post images of the brush (tips) you’re making and examples of the various resulting canvas images to illustrate your points?

That’s something @RamonM has already asked for and @dkazakov said it would be possible, afaik. Maybe in the future, then :slight_smile:


That will be an awesome feature. But things need time. So we need to wait for now. @dkazakov is doing as much as posible. :smiley: but you know what? We can paint already with what we have. Please watch this video and in the link description there is a file that you can download for experimenting and also brushes.


I downloaded the RGBA bundle listed in that video, and the DA OIL RGBA Grey brush is a perfect example of what I’m looking for. Basically, if that brush could use the color picker to replace the grey, it would be perfect. My assumption for how it would work is that the brush engine would get the alpha and the value from the brush tip image, and the hue and saturation from the color picker.

Can anyone point me at what files in the source would handle these things? I just started looking at it, and it’s a pretty large project, so I’m not entirely sure where to look for making changes to the pixel engine and the UI page where the options would be added. I do have experience with C++ and QT, so if I can find where to look, I can probably propose/submit edits to add this functionality.


Hi! That would be awesome; you can hop on IRC to talk to developers, mainly @dkazakov since he was supposed to implement it. Go to this website:|?#krita


Yep, that would make painting “realistically” in Krita level up. Can’t code to save my life, but that would be a great addition to Krita. Thanks for your interest in this feature. :slight_smile:


Okay, I have the basic idea of it working. Right now, the way I have it, any colors with max value/lightness in the brush image come through as the chosen color, and anything darker in the brush image is a darker version of it. I could change it so the saturation from the brush image is kept, which would mean that the brush image would have to have a color (instead of black/gray/white) where the chosen color would come through, but it would allow both black and white to come through on the brush. I’ll try to make some screenshots to show what I mean, in case that’s confusing. Anyway, let me know which you prefer. Ideally I’ll make it a choosable option, but I haven’t played around with the UI yet.

1 Like

Finished, and it works like a charm! Attached image shows the same brush using different colors. Also shows how it handles black and white, and less saturated colors. Basically, using the original image, anything white or black stays that, and in between scales to the selected color. So you can have outlines, shading, and highlights in your stamps. I’m sure this can be used for traditional brushes as well. As far as I can tell, I haven’t broken existing brushes either. I’m going to submit the changed files to one of the devs hopefully tonight, and fingers crossed we’ll see it in an upcoming version soon!!


What is amazing about these prototype brushes in the video is that they were made without an “impasto” engine or canvas lighting tool. I wonder what the brushes would look like with a proper impasto engine. I love Van Gogh’s colorful paintings.


Found something I was missing when I tried to use the brushes from the video with this. Turns out those brushes are saved as PNG brushes instead of GBR (Gimp) brushes, and PNG brushes weren’t set up to use color as mask. They could only be a mask if they were a pure grayscale image (with no alpha). I’ve now updated my code to allow PNG brushes to use color as mask like GBR brushes. Haven’t done a ton of testing yet, but those brushes appear to work now. Here’s a quick image of those with different colors.


Here is a testing package:

I’d like to change the patch codewise, but functionality-wise it looks okay.

Btw, what do you think about the naming of the function. I’m not sure that having it a submode of “Use Color as Alpha” makes sense. Or I am wrong?

UPD: oh, we don’t call it “Use Color as Alpha” anymore… It is “Use Color as Mask”, which is a bit more logical… Though I’m not still very sure about the UIX. It would be nice to get painter’s input on that.

Yeah, I think there could be a better name for the function. The original could be “Use image as Alpha Mask” and the new one could be “Use image as lightness map,” and they could be a radio button, with the third option being “Use image as stamp.” Or something like that. I’m not sure what the best terminology would be for it to be easily understood, but since there are three choices, a radio button probably makes more sense than two checkboxes.

I’m a noobie on this forum, and my Krita knowledge is not too much either.
This feature is awesome! So thank you very much! Krita is wonderful!
I’m tested it a bit, with some tinkered Ramon brushes. I recorded some video too, but I don’t want to upload it to youtube or else. If you want to, I can upload it, it’s oddly satisfying to watch it!

There is a wetransfer link to the video, if you interested in it:


Here it is an other image, I can do upload just 1 image\ reply, sorry!

The name of the function should probably be something that gives a good hint of the function to non-digital artists. How about “Use image to map color streaking” or “Use image to map ‘pseudo-impasto’” or “Use image to map color value”. Of the three that I chose, “Use image to map color value” seems the most clear as to the function involved in this proposed feature for the brush engine. I’m sure artists familiar with color theory would have an idea that color value indicates the “darkness” of a color; however this depends on what other color dimensions are involved in this feature. The other two color dimensions I’m familiar with are hue and saturation.

I’m not sure if “value” is a better choice than “lightness” because of how I made it work. I originally tried making it with HSV, and black would map to black, but white would map to full color instead of white, so you could do outlines and shading, but no highlights. To get white in HSV, you have to remove saturation as well. I switched to using HSL (hue, saturation, lightness) because that maps more directly to what I was going for (black maps to black, white maps to white, and gray maps to the selected color).

Maybe it could be labeled “HSL Lightness map” to make it clear that it uses HSL color theory instead of HSV. I suppose that’s probably more computer speak than artist speak, but I’m guessing artists making their own brushes probably understand the difference. Tooltips could probably help here too.


Hi, all!

Here is a package with fixed color spaces and a bit modified algorithm:

Please test it and tell your opinion! :slight_smile:

What has changed:

  1. Now the color mapping works differently from the original version. It works as “Overlay” blending mode, but in HSL space. 50% gray areas of the brush don’t change brush color, <50% gray areas make it darker, >50% gray make it brighter linearly.

  2. The feature works in all existing color spaces.

  3. All pixel brushes should work about 10% faster now :slight_smile:

Questions I want you to answer:

  1. How to name this brush option? It is not much related to “Use color as mask” option, btw.
  2. What extra GUI needed? I guess it would be nice to be able to adjust “neutral point” of the brush mask (which is now 50%) and its “contrast”, like we do that for textures. Though I’m not sure how to design that in user-understandable way :slight_smile:
1 Like

Not sure what happened, but when I try the one you just posted, all stamp brushes are completely broken. It doesn’t even matter what settings I use. With what it’s doing, it looks like a memory access issue, like it’s drawing something from the wrong part of memory, or it’s not clearing the memory correctly. Even the brush tip for the mouse looks completely wrong. Here’s a screenshot.

Same here on laptop. I need to test them in Desktop with open GL active to compare. Just let me a few hours
Thanks everybody for the feeback and interest. This is going to be intensive but the final result will surprise a lot of people.