Here I have a simple image of a cat: enter image description here

I add a new layer on top of it and near its mouth area I add a small circle and apply gaussian blur to it, and set the mode of the layer to overlay to create this(I used this merely for demonstration):

enter image description here

Now, suppose that I wanted the same effect more intense and that I duplicated the same circle layer two times, to create this: (all of them in overlay mode)

enter image description here

Now, How do I keep the effect of the three overlay layers but make them only one single layer? If I merge them down, the effect goes away:

enter image description here

How can I do this in GIMP?

EDIT: Just for the clarification for other folks whom I directed to this post, another reason to want to do this is when we create a layer mask for the above layer with overlay we may have to copy and paste the layer mask to every overlay layer and making edits to layer masks even troublesome.

  • Why can't you just leave it as a group? Why do you need to flatten it? Couldn't you just export the image before flattening it if that's the desired effect? – LateralTerminal Jan 30 '18 at 21:18
  • 1
    Suppose I have 10 layers that have different blending modes. No wait, 20 layers for a major thing... again just suppose. Now, they're arranged in such a way to give a particular image to the base picture. but, they are supposed to be a single unit to give the effect. Now just moving a top layer below them all and again inserting testing layers between them would be a real pain IF THEY'RE SUPPOSED TO BE ACTING AS A SINGLE UNIT. – mathmaniage Jan 31 '18 at 10:45
  • 1
    It'd be very convienient for users to define a custom layer that allowed to control a certain composition of layers and created a layer formula on the fly. I'll try to code it, I can only in python, if possible during my vacation. If you're a programmer. Tell me if it's possible in python and give me some suggestions. – mathmaniage Jan 31 '18 at 10:46
  • 1
    Well I encourage your project. I hope it's a success! – LateralTerminal Jan 31 '18 at 21:08

The equation of the Overlay mode is:

enter image description here

Where I is the composition of all layers under the layer in Overlay mode and M is the Overlay layer.

With 3 layers, the result of the top layer is E, the next layer applies the same formula (replacing I by E) and the third layer does this again. I'll let you figure out the resulting formula, and see if there is one of the blend modes that matches it. Answer: likely not.

Combining the layers in a group won't help, since this gives the same result as merging the layers and then putting the resulting layer in the blend mode of the group.

There may be ways to achieve equivalent effects, but they would be different depending on the image.

  • But, I was asking for a solution, but, this is more like an explanation to my question – mathmaniage Jan 30 '18 at 14:31
  • Is there such a thing in photoshop? – mathmaniage Jan 30 '18 at 14:31

GIMP documentation has the equation how the result of overlay mode is calculated. It's a second order polynomial of original color intensity value. The result is a fourth order polynomial of the original image color intensity if the same overlay is inserted twice.

There's no fourth order functions in layer mode equations => no single layer with well selected layer mode can give the same result as inserting 2 or more identical overlays.

You have a theoretical possiblity to write a pixel level script which calculates the same function as inserting 2 or more identical overlays. Writing such script and giving any instructions how to write it and how to keep the result compatible with the non-extended GIMP is unfortunately well beyond my capablities.

ADD (inspired by the comments)

If somehow resembling visual effect is enough, you can try inserting a 50% grey layer behind your cat photo. Give to the cat photo mode=Hard Light. Paint yellow onto the grey layer.

enter image description here

  • I don't really know that myself. But, That means there's no tool in GIMP that does that? – mathmaniage Jan 30 '18 at 14:01
  • 1
    @mathmaniage But there probably is a technically more slick way to create a result which isn't mathematically equivalent, but still creates the same impact as a visual experience. You want saturated yellow and visible dark and white from the original. – user287001 Jan 30 '18 at 14:46
  • 1
    @mathmaniage sorry, I'm not a programmer. – user287001 Jan 30 '18 at 14:53
  • 1
    Yes, you can write pixel-level stuff in Python, but looping on pixels can be slow. See here for some example code using numpy, resulting in near-native code speed. – xenoid Jan 30 '18 at 16:02
  • 1
    Fraught with peril.... Plenty of gotchas with 8-bit arithmetic. If you do what you did above on layers with "slow" gradients, you'll see plenty of banding and other artifacts. – xenoid Jan 31 '18 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.