Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

I have two images (For the sake of simplicity, Image1 and Image2). I want to use Image2 as a transparency for Image1.

How can I do that? Assume I've done little more with Gimp than play with some filters.

Thanks.

share|improve this question
2  
Is Image2 a grayscale image? Since transparency uses a 0..255 value for each pixel, it is like a grayscale image in this respect. –  mgkrebbs Jul 14 '12 at 2:25
add comment

2 Answers

OK, so I assume you have two images: a normal image that you want to add transparency to, and a grayscale image that you want to use as its alpha (transparency) channel, something like these:

Base image without transparency Alpha mask for image
(Base image based on this photo by John Fielding, used under the CC-By-SA 2.0 license; alpha mask created by me using the GIMP's Sphere Designer tool.)

There are several ways to do this; let me describe a few of them.

Method 1: Open both images in the GIMP. Select the grayscale image and copy it to the clipboard (Edit → Copy or Ctrl+C). On the base image, select Layer → Mask → Add Layer Mask... (also available by right-clicking the layer in the Layers dialog). It doesn't matter what you choose as the mask, since we'll be replacing it shortly.

The layer mask you just added should be selected for editing; if not, select it with Layer → Mask → Edit Layer Mask (or just click the mask in the Layers dialog). Paste the grayscale image in (Edit → Paste or Ctrl+V) and anchor the resulting floating selection into the mask (Layers → Anchor Layer or Ctrl+H, or click the Anchor icon in the Layers dialog).

Optionally, turn the layer mask into an actual alpha channel using Layer → Mask → Apply Layer Mask (but simply exporting the image as PNG will do that for you).

Method 2: Open the images as layers (File → Open as Layers...) or just paste one as a new layer into the other. With the grayscale image layer visible, open the Channels dialog, right-click one of the Red/Green/Blue channels (they should all be identical) and select Channel to Selection. Invert the selection with Select → Invert or Ctrl+I.

Select the base image layer in the Layers dialog. Add an alpha channel for it with Layers → Transparency → Add Alpha Channel if it doesn't have one already, and then cut the selection away from the layer (Select → Cut or Ctrl+X).

Method 3: As method 2, but after Channel to Selection, don't invert the selection, but simply use Layer → Mask → Add Layer Mask... on the base image layer and choose "Selection" from the dialog. Then optionally apply the mask as in method 1.


In any case, whichever method you used, the result should look like this (actual transparent PNG on left, with checkered background on right):

Merged base image and transparency, actual transparency Merged base image and transparency, checkered background

share|improve this answer
    
Method 1: a key point is to anchor the pasted image - if you haven't got the layers dialogue open it's not obvious that even if you do "paste into" the image doesn't become the layer mask until you tell it to anchor. That's what led to me searching and coming here. –  Chris H Dec 12 '13 at 15:26
add comment

Read tutorials

Gimp Layer Mask
Everything You Need to Know About Gimp Layer Masks

Common algorithm can be:

  1. Create SomeMaskLayer with transparency.
  2. Right-click on the SomeMaskLayer and choose “Alpha To Selection(In Dock "Layers")
  3. Menu Select -> Save To Channel.
  4. Hide SomeMaskLayer. (In Dock "Layers")
  5. Create SomeRasterLayer. (File -> Open As Layers, or paint)
  6. Right-click on the top layer and choose “Add layer mask”. (In Dock "Layers")
  7. In dialog window choose Channel option, and choose your new Channel in the combo. Click Add.

Ok, now you have "live mask".

  1. Right-click -> Apply Layer Mask to baking mask to pixels. (In Dock "Layers")

Enjoy!

share|improve this answer
    
Thanks for the tutorials. However - They assume a background in graphics, not programming. In addition, I don't get the side-panels they show when I open Gimp. Third, I already tried opening Image1 as the first layer, Image2 as a second layer and then adding a white layer mask while on the second layer. It didn't work. –  Narf the Mouse Jul 13 '12 at 22:25
    
Or at least, it appeared not to work. There's no real change in the image whether I invert the colors or not. –  Narf the Mouse Jul 13 '12 at 22:27
    
1.about panels(Docks in GIMP): try to use Single-Window Mode: menu Windows/Single-Window Mode .... 2.probably just Docks is hidden: menu Windows/Hide Docks (or press Tab) –  swift Jul 13 '12 at 23:50
    
at the new channel, I had to set "fill opacity" to 0. Also I did not "apply layer mask" because I still want to be able to change the image. I just wanted to apply transparency on specific regions on all layers. So I added the mask, with channel option, to each of the layers, and it worked perfectly, thanks! –  Aquarius Power 2 days ago
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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