Episode: 3480 Title: HPR3480: Darken Layer Modes Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3480/hpr3480.mp3 Transcribed: 2025-10-25 00:09:42 --- This is Hacker Public Radio Episode 3484 Friday, the 3rd of December 2021. Today's show is entitled Dark and Layer Modes and is part of the series Gimp It Is Hosted by Aoka and is about 15 minutes long and carries a clean flag. The summary is more on layer modes and Gimp with the Dark and Modes. This episode of HPR is brought to you by an honest host.com. Get 15% discount on all shared hosting with the offer code HPR15. That's HPR15. Better web hosting that's honest and fair at an honesthost.com. Hello, this is Aoka, welcoming you to Hacker Public Radio and another exciting episode in our ongoing Gimp series and we're continuing our look at layer modes. Today we're going to take a look at the ones for darken. Just as there were a number of lighten modes, there are the opposites of that, the darken modes and in many ways they're just the reverse of the lighten modes. The first one is darken only which is quite literally the opposite of lighten only. Remember that lighten only we went channel by channel through the two images and always picked the highest number, the latest one. Darken only we go channel by channel through the two images and we always pick the lowest number, the darkest in each channel for the final image. So it's just the resulting image is the lesser of the two. Now again you might hear people say that is selecting the darkest pixel. That's not quite correct. You need to look at the color channels individually to understand what is going on. Now to see this we'll do the same thing we did with the lighten where we took a red square and a blue square and when we combine them what happens? Well when we mix those two layers using lighten only we got a magenta layer and that probably made intuitive sense since magenta is a combination of blue and red. But if you mix them using darken only you get a black square. Now if this surprised you let's take a look at what is happening in each channel, the red channel for the red layer has a value of FF whereas the red channel for the blue layer has a value of 0.0 which is this lower, the 0.0 obviously. Then for the green channel both layers have 0.0 so the result is 0.0. Finally for the blue channel the values are 0.0 for the red layer and FF for the blue layer. Again the lower value is 0.0 the final image has pixel values of 0.0.0.0.0 in each pixel and of course that is pure black. Now to be fair in a lot of cases it doesn't make a big difference whether you think in terms of the darkest pixel instead of the darkest channel value but in edge cases it will make a difference and I just think it's important to learn to think about these things logically if you're going to master digital graphics and that definitely means understanding how digital color works in RGB space. You always have to analyze each channel of each pixel to get a full understanding and mixing colors digitally can be very different from mixing paint and pots. Your intuition may let you down. Now when we use this with our two images the dog image which is darker tends to predominate the resulting image but because there is white in the right hand side of both images we get a little white in the final result and because there are highlights in the dog image that are lighter a little the toy image comes through in those places. Now this mode is of course commutative so the order of the layers does not matter. Next Luma Luminance darkened only. This is very similar to the Luma Luminance lightened only except of course opposite. Again the key difference is that Luma Luminance works on how the human eye perceives colors and brightness rather than how an instrument might measure them. I did a more complete explanation in the lightened section of what is going on with this so I won't repeat all of it here. Go back and check that if you want all the details, link in the show notes of course. When I did that using the Luma Luminance darkened only I got a resulting image that again looks very similar to the darkened only mode. Now my eyes cannot see the difference. I know there is a difference because the file sizes are slightly different. That's a clue right there. I export my images from GIMP using portable network graphics format or PNG. Which I tend to use because it has some great features. First it is a raster graphics format which makes it ideal for GIMP images which are also raster graphics. Second it has lossless compression which makes it superior to the JPG or JPEG which uses lossy compression. It's also better than JPG by incorporating an alpha channel for transparency which as you have seen we use a lot in GIMP. One of the things I find working with images in GIMP is if I open a JPEG image the first two things I do is number one I make a duplicate and number two is I add an alpha channel or maybe I add the alpha channel first and then make it. But those are the two things that I always do with a JPG image. Creating a duplicate layer I do with any image. Unlike GIF images the compression is well suited to photographs. GIF does not work well with photographs and another good thing that makes PNG similar to GIF or GIF is that there's no patents in covering it. So for all these reasons I consider PNG portable network graphics to be the superior format for digital images and I use it almost exclusively. Now in many cases I may be starting with a JPG image because my telephone takes pictures in JPG you know most digital cameras take pictures in JPG and probably because the file sizes are a little smaller and in a lot of cases you know people are just taking snapshots with their phone they're not looking for the ultimate quality they want to just take a lot of pictures. So if I'm starting with a JPG image it's undoubtedly lost some of its information already but if I then work in PNG it means at least I won't lose anything more as I go. Now if you were a professional or a dedicated hobbyist you might invest in larger storage and shoot what are called raw images. These are minimally processed and in fact calling them images is not entirely correct they're just digital data but what they're doing is they're recording the actual data as the sensor collected it. They aren't images yet they have to be processed to become images. They're sometimes called digital negatives for that reason but to my mind this is a case of the analogy breaking down they're not negatives in any real sense of the term. Suffice it to say that raw images give you the highest achievable quality in a digital photograph. Now as it happens GIMP cannot open raw images directly but you can use dark table in conjunction with GIMP via a plugin and I will probably talk about that at some point but that's down the road but I just mention it now because if someone is desperate you know through a Google search for dark table GIMP plugin and you know you should be able to get what you want. Basically what happens is that GIMP uses dark table as an accessory program to let you do some stuff so if you want to edit raw images you have to edit them in dark table and then once they're edited you can bring them in as PNG images into GIMP. Okay so back to our image. We had the darken only and the darken only luma luminance. I said I couldn't see the difference I loaded them both into GIMP and I use the difference layer mode and what I'm seeing is basically a black image but with bits of blue so the blue streaks that I'm seeing in there are where there is a difference it's very you can see it's very subtle there is something there. Now multiply this is another darken and this is another commutative one so the order of the layers does not matter. The value is computed for each channel RGB and the way it's computed is you take the value from the top image and the value from the bottom image multiply them together and then divide by 255. So you take a look at our old red and blue layers and combine them what would we get? The red will have FF for the red channel the blue will have 00 or in base 10 numbers 255 and 0. Zero times 2 5 5 is 0 so the resulting value is 0. The green channel is 0 times 0 which is 0 and the blue channel is 0 times 255 which is 0. Let's take a different set of numbers. Suppose the value in one image is 150 and the other is 150 as well. Multiply those together you get 22500. Now divide by 255 and you get just over 88 which is a bit over half of the two original values making it roughly twice as dark. So you can see the net effect is dark and again I did a sample example here and you can very clearly see both the dog and the toy but overall it's a darker image. There are still a few light spots particularly along the right hand side because that was white in both of the starting images. Linear burn is another one this is similar to multiply but instead of multiplying you're adding and subtracting hence the linear. This is not yet documented but according to Mike Davies and he's another one of the experts that I frequently learn from. The formula involves adding the two values together and subtracting 255 from the result. Now I assume that you know we looked at addition and the addition mode in the lighten modes and said you know you can't get over 255. On this linear burn I believe the same thing applies so if the result is a negative number you just set it to 0. So two fairly small values would combine to 0 and two fairly dark pixels would combine to be black. Using our red and blue squares as examples the red channel would be 255 plus 0 and then minus 255 so the result is 0. The green channel would be 0 plus 0 minus 255 again 0. That's the lowest permitted value and the blue channel would be 0 plus 255 minus 255 equals 0. So the resulting image would again be pure black. Now looking at our two images we see that this produces more pure black than any of the other darkened modes and it makes sense when you look at the formula. You're just going to multiply the number of pure black pixels in the image. Now because that's because the formula is linear instead of geometric. Now the other darkened mode is burn which we covered in the previous tutorial so I won't repeat it here but a little tidbit I'll just mention again. Dodge and burn are originally darkroom techniques from film photography. When making a print from a film negative you would shine light through the negative to expose the print film but you could use masking to alter the exposure. If you wanted something to be darker in the print you would mask off everything except that area for part of the exposure. Thus overexposing or darkening that section. This was called a burn and that makes sense. Dodge is just the opposite. During the print exposure you would block off a section to make it lighter. So what Gimp and other digital graphics programs do is they emulate this technique in software. So with that this is a hook up for hacker public radio signing off and it's always encouraging you 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 contribute link to find out how easy it really is. Hacker Public Radio was founded by the digital dog pound and the infonomican computer club and is part of the binary revolution at binwreff.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 status, today's show is released on the creative comments, attribution, share a like, 3.0 license.