2

I'm using GIMP, and I have a smaller image in the second, above layer. I don't see a way / "Mode" that allows me to use this image to "cut a hole" in the image in the lower layer (matching the shape of the image above).

How do I do this? Thanks.

2 Answers 2

2

If the image above is on transparent background:

  • with the top layer active: Layer>Transparency>Alpha to selection (this create a selection which is the exact shape of the opaque bits of the top layer)
  • with the bottom layer active: Edit>Clear (make sure the layer has an alpha channel if you want the removed part to be transparent)
0
2
+50

New answer for Gimp 2.10

In Gimp 2.10, there is an Erase layer blend mode that essentially makes the layer act as a cookie cutter for the layers below it. So if you want to cut a layer to a shape:

  • Set the shape at the top, and set to Erase blend mode
  • Add the layer to cut through below it
  • Put these two in a layer group to restrict the cookie-cutter effect (otherwise it will act on all layers below)

enter image description here

If you want to keep the shape and cut the rest, there is no inverse equivalent of the Erase blend mode, but you use a subgroup to invert the opacity of the shape:

  • Add a subgroup
  • Put the shape layer in Erase mode at the top of the subgroup
  • Add an opaque image-sized layer at the bottom (color indifferent, you just need all pixels to be fully opaque))
  • Use the subgroup as the Shape layer in the solution above (so, this subgroup should also be in Erase mode)

enter image description here

The benefits of this technique over the 2.8 one is that changes in the shape layer have an immediate effect on the image without having to repeat operations. In particular, instead of having one shape layer in the group of subgroup, you can have several and toggle their visibility.

Even simpler solution: move the "shape" layer under the layer to cut, and set the Composite Mode of the layer to cut to Clip to backdrop. Put the two layers in their own group so that the "backdrop" is the group contents, and not the whole image. The previous solution may still have its uses in some cases.

enter image description here

4
  • This is an excellent answer which should get more votes, both for its precise explanation and for being up to date.
    – Canned Man
    Commented Feb 5, 2023 at 23:27
  • 1
    @CannedMan Thanks for the appreciation. Byut since you drew my attention again to this answer, I find that there is an even better &nd seimpler technique for the second part (keeping the shape instead of erasing it). Will amend this answer shortly...
    – xenoid
    Commented Feb 6, 2023 at 20:37
  • 1
    @CannedMan Amended answer, in case you are interested
    – xenoid
    Commented Feb 12, 2023 at 13:07
  • Excellent! Thanks for the update. I just hope this answer gets upvoted more now; it deserves it.
    – Canned Man
    Commented Feb 16, 2023 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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