I have two images. I'd like to slice one image based on the dimensions of the other image. E.g. I have a triangular image and a regular image, I want to put the triangle image over the regular image and get an image of what is under the triangle image.


Images are always rectangular - they may look like they have otehr formats doing to all parts out of a certain area are transparent.

So, what you want is to carry the transparency information of the second image to the first image. One way to do this, once you have the second image as a layer above the original image in the same GIMP document is:

  1. click on the second image, on the layers dialog (ctrl + l), right click and pick Create layer mask on the layer's context menu. On the following dialog choose Layer's Alpha Channel. You have now a mask wich is a B&W representation of the trasnparent areas as the Layer mask - GIMP allows you to copy this as you do with the ordinary pixels of a layer. You can see a thumbnail for the mask visible on the Layers dialog.
  2. Edit->copy (this will copy the mask pixels to the clipboard). Ensure you have no selection active on the image before doing it.
  3. hide your second image (click on the eye icon), select your first image, and, again, click on the Create layer mask.... Pick "White (full opacity)" 1.
  4. Edit->paste and Layer>Anchor (or just click on the Anchor button).

This will copy the transparency information to your first image - now just export your image to png, and you are done.

there is a similar answer here as well: Gimp — combine alpha from one layer, with rgb image of another

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.