- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
169 lines
17 KiB
Plaintext
169 lines
17 KiB
Plaintext
Episode: 3350
|
|
Title: HPR3350: Blending Layers
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3350/hpr3350.mp3
|
|
Transcribed: 2025-10-24 21:25:02
|
|
|
|
---
|
|
|
|
This is Haka Public Radio Episode 3354 for Friday 4th of June 2021.
|
|
Today's show is entitled Blending Layers and is part of the series GIMP.
|
|
It is hosted by AYUKA and is about 22 minutes long and carry a clean flag.
|
|
The summer is GIMP and a number of ways you can blend layers together.
|
|
This episode of HBR is brought to you by An Honest Host.com.
|
|
A 15% discount on all shared hosting with the offer code HBR15.
|
|
That's HBR15.
|
|
Better web hosting that's honest and fair at An Honest Host.com.
|
|
Hello, this is AYUKA, welcoming you to Hacker Public Radio and another exciting episode
|
|
and our continuing look at GIMP, that wonderful GNU image manipulation program
|
|
that lets you do so many wonderful things.
|
|
Today we're going to take a look at really kind of open the whole discussion of blending layers,
|
|
which is a big deal.
|
|
In fact, it's going to take us several episodes to get through all of this.
|
|
If you're getting the impression that layers are a really big deal, well, they're a really big deal.
|
|
So you've got the right impression indeed.
|
|
Now, blending layers.
|
|
This is where, in this particular one, we're going to get into opening up some of the mathematical processes involved.
|
|
Because digital image editing is a process whereby mathematical expressions produce something you can look at.
|
|
Now, there's two different ways that mathematics can enter into this in a RASTER-type program, which is what GIMP is.
|
|
That means that each pixel has numbers that represent the four possible channels, red, green, blue, and alpha.
|
|
And those numbers determine how that pixel will appear in the image.
|
|
Now, a vector-based program, like Inkscape, in contrast, uses equations to define overall elements in the image.
|
|
Now, these two approaches mean that each program has strengths and weaknesses, so you would be well advised to choose carefully.
|
|
For example, if you're creating an image that you want to resize it will without a loss of clarity and sharpness,
|
|
you really have to do that in a vector-based program, like Inkscape.
|
|
The equations don't care about scale, so you can scale them up, scale them down.
|
|
They're going to look equally good at any scale.
|
|
However, a vector-based program cannot reproduce photographs very well, since photographs are inherently RASTER-based.
|
|
Now, because GIMP is RASTER-based, it is great for working with photographs.
|
|
And you can make use of the mathematics to manipulate the pixels, which is what GIMP does in accents.
|
|
And one excellent example of this is the ways you can blend layers.
|
|
Since the individual pixels are just numbers, you can write algorithms to combine them in different ways.
|
|
Now, one of the simplest is by making use of the opacity control on each layer.
|
|
So what that is doing is manipulating the alpha channel value on each of the pixels in an image on a particular layer.
|
|
So that's really what you're doing there.
|
|
So I wanted to illustrate this, and as I said before, I'm trying to go to a different site for my images each time,
|
|
just to illustrate how many wonderful sources there are of images that you can use freely.
|
|
So I went back first to that Wikimedia site to find another repository.
|
|
And I saw one that looked interesting called the Famous Artists.
|
|
And there's a link to that in the show notes, of course.
|
|
So the Famous Artists, these are digital images of artworks created in previous centuries and are all in the public domain.
|
|
So, and I'm going to apologize in advance for mangling some names here, because the image that caught my eye was from a Korean artist, and I don't speak Korean.
|
|
I'm very sorry. So, please don't, if you are Korean out there in the audience, please don't laugh at me too much.
|
|
So, there was a pretty famous painting by a Korean artist Jong-Soon, and it is a painting of a famous mountain in what is now North Korea.
|
|
And the painting is called Gyung-Gon Jjando, or General View of Mount Gyung-Gon Sun.
|
|
And there's a link in the show notes if you want to check this out, and you can see the manipulations I do on the webpage, which is also linked in the show notes.
|
|
So, to illustrate what you can do, I opened this picture in GIMP 2.10.22, which is the latest version as I write this.
|
|
Since this image is a JPEG, and I wanted to work with transparency, the very first thing I had to do was add an alpha channel, which I did by right clicking on the layer in the layers window, and clicking add alpha channel in the pop-up that resulted from that.
|
|
Next, I created a second layer, which I named background. This layer is the exact same size as my original image, of course, which makes this easy.
|
|
That's why I do these in a certain order. You know, anytime you've already got an image there, and you create a new layer, that new layer will always be the exact same dimensions.
|
|
So, with that, I then turned to my Gradients panel, and selected Yellow Orange, and just dragged that across that layer to fill it with this gradient.
|
|
So, it was a little yellower on the left, and more orange to the right, filled my new layer with this gradient, and I made this new layer my top layer, which meant I could not see any of the painting.
|
|
But, if you take a look when you have a layer selected, right above the layers, there is a thing called Opacity, and that Opacity Control applies to whichever layer is the active one.
|
|
So, this Yellow Orange layer was the active one, and remember, you can always tell what's active by looking for the thumbnail that has a white border instead of a black border. That always tells you which one is active.
|
|
So, with my Yellow Orange layer as the active layer, I reduced the Opacity using the slider, and got down to 35% on that, and got a really nice combination as a result.
|
|
And you can see the result I got on my website, which is, again, link in the show notes, was a very nice effect. I was very happy with that.
|
|
Now, I could have done it a slightly different way, I could have put the painting layer on top, and then reduce its Opacity, but in that case, to get something similar, I would have to reduce its Opacity to around 65%.
|
|
So, you can see the mixing, the blending is about 35% the color, and 65% the painting.
|
|
So, this type of blending is pretty straightforward, it's not too complicated, but you can do more, and that brings us to the topic of layer modes.
|
|
Now, in GIMP 2.10, there are 38 layer modes. Now, these are also referred to in some occasions as blending modes, so get used to both of these terminologies if you go looking for stuff on the web.
|
|
And they're sorted into seven groups. And the seven groups are normal, lightened, darkened, contrast, inversion, HSV components, and LCH components.
|
|
Now, if you check the GIMP documentation for GIMP 2.10, you'll discover that a number of these modes are not documented.
|
|
The 21 modes in the previous version, 2.8, are documented, but not the 17 new ones. Now, that poses a problem for this tutorial since I cannot see the precise equation or algorithm used in these particular modes.
|
|
Now, there are still some decent resources available, including some YouTube videos and websites. I've got links to them in the show notes, and I would say they would repay a little attention.
|
|
For instance, there's a tutorial specifically on LCH blend modes that I found on a website, a couple of YouTube things. In particular, Mike Davies did a all layer modes explained video. Very nice.
|
|
There's also a good general discussion of the concepts and mathematics of this on Wikipedia, and that's also linked in the show notes.
|
|
Now, in this case, that's not a detailed documentation of each mode. It's more like background, what is all of this stuff about. It's not limited to GIMP since Photoshop modes are covered.
|
|
And these are, it's not just GIMP and Photoshop, I think, a lot of graphics programs, raster-based graphic programs are doing similar things.
|
|
So, it's a good theoretical background to how all these blending modes operate, and if you want to dig into it, again, link in the show notes. Some good information there.
|
|
Now, as with other operations, these modes use equations to determine how to combine two layers on a pixel-by-pixel basis.
|
|
The mode is set on the top layer. So, if you remember from what we just talked about that above the list of layers in the layer window, there's a thing that says opacity that you can slide back and forth.
|
|
And right above that is the layer modes, and that's a drop-down selector.
|
|
So, whichever you need to select the top layer, and then with that layer selected, you can choose the layer mode. So, that's the way this thing works.
|
|
This means, of course, you need to have two layers to accomplish anything. So, okay, good. Need to get some images.
|
|
So, this time, do something different. I went to the Creative Commons site of freely reusable images.
|
|
And while I was there, I made a small donation to support their work, as my friend Dordador Geek likes to say, support the people who support you.
|
|
Now, if you go to this Creative Commons site, you can search, and so I put in some search terms.
|
|
The site has works under a variety of Creative Commons licenses, but you can filter the search results by license type.
|
|
So, just to be safe, I filtered on CC zero licenses, and grabbed a picture of a dog, because I really like dogs.
|
|
And I've got a link in the show notes if you want to see the full image that I got. And then for contrast, I found an image of some toy figures.
|
|
So, if you take a look at my website, you'll notice that while I specifically looked for CC zero licensed images, I'm still crediting the artist on both of these.
|
|
There's really no reason not to do so. I prefer CC zero simply because I know I won't accidentally violate a license, but I fully support creating the artist.
|
|
Now, my next step is bringing these images into GIMP. These images don't have exactly the same dimensions, and in either case, are somewhat larger than I want to work with.
|
|
In fact, if you take a look at my website, the images are wider than my website can comfortably display, so there's a great deal of distortion in the original image.
|
|
So, what I did in GIMP was I created a new image in GIMP, and it's just you open up GIMP and then new, and I created it with the dimensions of 480 by 480.
|
|
Now, I just created this as a blank white square. I only need it for a moment.
|
|
Then I opened both of my downloaded images as layers, and that's where you go to file, open as layers.
|
|
Now, one of the neat things about that is that automatically crops the images to fit the existing image at 480 by 480.
|
|
And these images were a lot wider than that.
|
|
And what is neater is that once that happens, you might look and say, well, that's not exactly the crop that I want, but you can use the Move tool to move the underlying image around until you get the crop exactly the way you want it.
|
|
So, when you open it as a layer, it's basically putting a frame there, but the whole image is behind that frame.
|
|
And you can move that image around until the frame shows the part you want.
|
|
So, definitely a good little trick.
|
|
So, once I had the cropping I liked, I duplicated each of the images and locked the duplicate to prevent any moving pixel editing, including the alpha channel.
|
|
Now, the way you lock a layer is there are three buttons. It's called lock, and it's right above the list of layers.
|
|
So, if you take a look in the layers window, you've got the list of layers, and then right above that or the lock buttons, right above that is the opacity slider, and right above that are the layer modes.
|
|
So, get used to looking and working with all of these things when you're there.
|
|
So, I locked all three. There's a lock for pixel editing, there's a lock for moving, and there's a lock for the alpha channel.
|
|
And so, I locked all three of these. This is my backup in case something goes wrong.
|
|
And then, I just, you know, turn off the visibility because I'm not going to... I mean, they're just there as backup.
|
|
And we talked about this before. I'm a really strong believer in keeping copies of all of your work at various stages, because you never know when you're going to want to go back.
|
|
Now, I didn't really need that blank layer any longer. I could, I suppose, delete it. But, again, why? All I have to do is turn off the visibility.
|
|
Then, looking at the duplicates I made, and they're fine, I do want to make sure I don't accidentally move them.
|
|
So, for those two layers, I just turned off the... I turned on the move lock so that they can't be moved.
|
|
Now, I put a screen shot of the layers window showing some of these things on my website, so you can see it if you go to that page.
|
|
Now, that I have these two images ready, and I show you what they look like cropped.
|
|
You know, I've got something I can use as examples when I go through illustrating these 38 modes.
|
|
Well, we still got a little background to go through. We're going to start with normal.
|
|
Alright, the normal category actually has six different types of normal modes.
|
|
The first one is called normal. Then, there's dissolve, color erase, erase, merge, and split.
|
|
So, the normal one is the default. It's the simplest one. It's what you've, you know, if you've been working at all with layers, it's what you've been doing all along.
|
|
In normal mode, and that is the default, it's what it is set to unless you change it.
|
|
The top layer covers the bottom layer. Simple as that.
|
|
But if there's any transparency in the top layer, some of the bottom layer will show through.
|
|
Now, some terminology. The top layer is also known variously as the blend layer, the active layer, or the mask layer.
|
|
The gimp documentation calls it the mask layer.
|
|
Now, the bottom layer is also known as the base layer or the image layer, and the gimp documentation favors image layer.
|
|
Now, I still like to use top and bottom because to me, that gives you a little more clarity as to what's going on here.
|
|
And remember, layers display in the order that they appear in the layers window.
|
|
So, the top layer in that window is the top layer.
|
|
Bottom is the bottom.
|
|
Now, in the gimp documentation, they use some relatively straightforward mathematics to show you how these modes give you a layer blend.
|
|
And we're going to start at the simple level. For each pixel, you have four channels.
|
|
Red, green, blue, and alpha.
|
|
Then you can give the values in each channel as a number between 0 and 255.
|
|
In other words, 8 bits per channel.
|
|
Now, for red, green, and blue, 0 represents no amount of the color, and 255 represents the maximum amount of the color.
|
|
So, if your RGB was 0, 0, 0, you'd have black.
|
|
If your RGB was 255, 255, 255, you'd have pure white.
|
|
Or you could have something in the middle of that. So, for instance, 0, 0, 255 would be pure blue.
|
|
0, 255, 0 would be pure green, and so on.
|
|
Now, for the alpha channel, full transparency is 0, and full opacity is 255.
|
|
So, what the program does in an image is combine the four numbers for each pixel in some way.
|
|
The GIMP documentation gives this simple example, e equals n plus i.
|
|
In other words, the final exported image will be n, which is the mask layer or top layer, plus i, which is the bottom,
|
|
or image layer.
|
|
So, you just add the numbers.
|
|
So, let's say the top image had a pixel, and the pixel had the values 100, 210, 104, 255.
|
|
And the bottom layer, the corresponding pixel, had the values 75, 108, 97, 0.
|
|
Well, you would just add them. Well, if you add them, you're going to get 175, 318, 201, 255.
|
|
Now, because 255 is the maximum, you can't really have a green value of 318, so that gets reduced to 255.
|
|
So, the resulting pixel in the final image would be 175, 255, 201, 255.
|
|
Now, in looking at the normal mode, GIMP documentation gives the equation for that as being e equals n.
|
|
In other words, only the top layer shows in the final result.
|
|
And I think this is overly simple since it ignores the effect of the alpha channel.
|
|
If you've applied some transparency to the top layer, then whatever is on the bottom layer will, of course, come through to some degree.
|
|
So, I think that what they meant by that is that the layer mode itself does not add any effect to the result, which makes their equation true in that way.
|
|
So, this is a lot of background on layer modes.
|
|
And now that I've got some images and some understanding of the mathematics and how all this stuff is working,
|
|
we're going to start getting into the individual modes, but that'll happen in the next episode.
|
|
So, this is Ahuka for Hacker Public Radio, signing off, and as always, encouraging to support free software.
|
|
Bye-bye.
|
|
You've been listening to Hacker Public Radio at HackerPublicRadio.org.
|
|
We are a community podcast network that releases shows every weekday Monday through Friday.
|
|
Today's show, like all our shows, was contributed by an HPR listener like yourself.
|
|
If you ever thought of recording a podcast, then click on our contributing to find out how easy it really is.
|
|
Hacker Public Radio was founded by the digital dog pound and the Infonomicon Computer Club, and is part of the binary revolution at binrev.com.
|
|
If you have comments on today's show, please email the host directly, leave a comment on the website or record a follow-up episode yourself.
|
|
Unless otherwise stated, today's show is released under Creative Commons, Attribution, Share a Light, 3.0 license.
|
|
Thank you very much.
|