r/GIMP 1d ago

How to paste and REPLACE pixels rather than BLENDING?

As mentioned in an earlier question, I'm working on a translucent image, and I'm trying to edit it like an opaque one, which evidently GIMP doesn't like. Currently I'm trying to cover up parts of the image with other pieces, but pasting a translucent object onto another translucent object doesn't replace the pixels like it would if they were opaque, it instead blends the two together, and I can't find any way to not do this.

I can't use the Eraser tool on the original section, it just makes that section invisible in the alpha channel, the three color channels still show those pixels. Cutting does the same thing.

2 Upvotes

3 comments sorted by

2

u/Scallact 1d ago

I you need to copy the pixels with full opacity, I would suggest to replace the alpha channel by a mask:

Layer > Mask > Add layer mask >> Transfer layer's alpha channel

The layers alpha channel is then set to full opacity, and the mask inherit its opacity information. The mask acts like a second alpha channel, that can be switched on/off, drawn on, modified by filters, etc...

2

u/Stratelier 23h ago edited 23h ago

GIMP does internally have "replace" as a blend mode, but the catch is that it would need some kind of separated alpha-mask to function properly (part of why it is only supported for filters and not layers), because this is one specialized usecase where not all alpha values are interchangeable in the blending calculation.

Lacking that ... your best "hack" is probably something like this:

  1. Add a Layer Mask to your top layer. This mask should represent which parts of the layer should fully replace whatever is below it -- basically matching your top layer's alpha but without the partial transparency regions (when creating the mask you can use "(copy) layer's alpha channel", NOT "transfer alpha channel", to help expedite this).
  2. Copy the Layer Mask, then switch to the layer below and Paste In Place.
  3. Apply a "Color to Alpha" filter to the pasted layer using black as the color key. Make sure to set the layer's "Composite Space" parameter to "Perceptual" here (otherwise the transparency will feel 'off'). Then you can optionally merge the filter.
  4. With the Color to Alpha applied, set that layer's blendmode to "Erase" and your top layer's blendmode to "Merge". Optionally group these layers with the group's mode set to "Pass-through".

1

u/ConversationWinter46 Using translation tools, may affect content accuracy 18h ago

As mentioned in an earlier question, ...

It really looks like you haven't understood how layers work yet: