I want to change transparency of a layer where the transparency can be changed by a brush ex: increase top layer transparency by 50% when I draw a line over a place. what I’m trying to do is have streaks of color over a black of white copy of a image. the streaks are also custom brushes that look like paint brushes even with semi transparency parts of it so it would have to be with a brush. I also have other uses for future projects after I learn this skill so a general solution or instruction on how to do so is wanted. something that could be using this technique elsewhere on the internet could be someone showing the image with a transparency brush over a first sketch.
2 Answers
You can do this with layer masking. It's a commonly used technique in raster image editing software such as GIMP, Photoshop or Krita, etc.
Basically you would set up two layers, one with your colour image on the bottom, and the black and white image on a layer on top.
To add a layer mask to a layer in GIMP, click on the Layer Mask icon in the layers panel. Then choose "White (fully opacity)" in the Layer Mask dialog, then hit Add
Select the white layer mask in the Layers Panel. Then you can paint on the mask with a brush.
If you paint on the layer mask in black, it will make that area fully transparent, revealing the colours in the layer below. If you paint in white, it will make that area fully opaque. If you paint on it in 50% grey, it will make that area 50% transparent.
Generate a layer mask which contains all transparency info of the layer. When you add a layer mask you get an opportunity to initialize the mask with existing layer alpha (=all cumulated transparency data)
An example: A layer with solid fill and a couple of strokes with the eraser. Layer > Mask > Add layer mask dialog is opened and option transfer the alpha channel is selected:
In the next image the fill color is again solid red, but all transparency is now in the layer mask (see the grey X):
Now you can select the mask icon and paint to the mask. Paint full black for full transparency or paint full white for 100% opacity. Paint grey for something between. Paint with transparent brush and let the brush have some blending mode other than normal for relative results. To be effective this needs knowledge of the blending modes.