Re: [Gimp-user] Copy the alpha channel from an image to another

2007-02-13 Thread Michael J. Hammel
On Mon, 2007-02-12 at 23:50 -0800, Germain Le Chapelain
[EMAIL PROTECTED]
 I would like to know who to copy the alpha channel of an image to
 another image.

1. Merge visible layers of the source image.
2. Copy visible layer of source image
3. Create new image for destination (as in File-New).
4. Add a layer to destination image
5. Delete background layer in destination image
6. Add black layer mask to only layer left in destination image.
7. Make black layer mask active drawable.
8. Paste into destination image.
9. Anchor to active drawable (re: mask).
10. Apply layer mask.

Now the destination image (at least in that one layer) has the same
alpha as your source image.

Steps 4-5 could be:

4. Add alpha channel to background layer
5. (delete this step)

Should also work in both 2.2 and 2.4.

I tried this with a simple white image (single layer) using a gradient
in a layer mask to create the source image.  I then applied the layer
mask in the source image to put the alpha into the layer itself.  When
this layer was copied to the black layer mask of the destination, the
visual appearance was correct.  When I saved both files (after applying
the mask in the destination) they have the same file size (as expected)
but they are not binary identical when saved as either XCF, TIFF or PNG.
Not sure why (maybe some metadata differences?).  I did notice that the
pasted copy had a selection outline that was not the full size of the
source image (both images where the same size).  So even though I did a
Select-All, Edit-Copy (I also tried Edit-Copy Visible), it appears to
only have picked up to a certain transparency level in the copy.  Or
maybe it's just that the marching ants only recognize up to a certain
level when pasted.

Maybe one of the developers has some insight as to why the source and
destination wouldn't be identical in this case.  
-- 
Michael J. HammelSenior Software Engineer
[EMAIL PROTECTED]   http://graphics-muse.org
--
Success is never hard won.  It is hard achieved.  --  Michael J. Hammel

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Copy the alpha channel from an image to another

2007-02-13 Thread Akkana Peck
Michael J. Hammel writes:
 On Mon, 2007-02-12 at 23:50 -0800, Germain Le Chapelain
 [EMAIL PROTECTED]
  I would like to know who to copy the alpha channel of an image to
  another image.
 
 1. Merge visible layers of the source image.
 2. Copy visible layer of source image
 3. Create new image for destination (as in File-New).
 4. Add a layer to destination image
 5. Delete background layer in destination image
 6. Add black layer mask to only layer left in destination image.
 7. Make black layer mask active drawable.
 8. Paste into destination image.
 9. Anchor to active drawable (re: mask).
 10. Apply layer mask.

That doesn't quite work for me, because the contents of the source
image get applied to the layer mask too (where the source image was
blue but opaque, the destination won't be fully opaque).

But you can fix that by adding two steps: between steps 1 and 2,
turn on Keep Transparency (checkbox in the Layers dialog, called
Lock in 2.3) for the source image, then fill the source image with
white. Then copy, and what you paste later into the dest image's
layer mask will reflect only the alpha channel of the original.

(Don't get too put off by the number of steps. I skipped steps 4 and
5, but I was only using single layer images; maybe they're important
for the general case. And I skipped step 7 because it happens
automatically from step 6.)

This doesn't actually give you an image with an alpha channel, as
the OP asked; it gives you a layer with a layer mask that mimics the
original image's alpha channel. But Merge visible layers will turn
that layer mask into an alpha channel if you care about the difference.

-- 
...Akkana
Beginning GIMP: From Novice to Professional: http://gimpbook.com
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Copy the alpha channel from an image to another

2007-02-12 Thread Claus Cyrny
Hi,

Germain Le Chapelain wrote:
  
 Hi,

 I feel like my question might be very stupid :

 I would like to know who to copy the alpha channel of an image to
 another image.

Simpy select the alpha channel with 'select all' ([CTRL]+A)
and copy it into the clipboard. Then go to the second image
where you want to insert the alpha channel, select the image
([CTRL]+A again), and copy this selection into an alpha channel
('Select  Save to Channel'). Then just select this new alpha
channel in the 'Layers/Channels' menu and paste the alpha channel
([CTRL]+A, [CTRL]+H) from the clipboard into it. That's all.

HTH,

Claus


___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Copy the alpha channel from an image to another

2007-02-12 Thread Germain Le Chapelain

From: Claus Cyrny [mailto:[EMAIL PROTECTED]
Sent: Mon 2/12/2007 11:44 PM
To: Germain Le Chapelain
Cc: gimp-user@lists.XCF.Berkeley.EDU
Subject: Re: [Gimp-user] Copy the alpha channel from an image to another
 
  Hi,
 
 Germain Le Chapelain wrote:
   
  Hi,
 
  I feel like my question might be very stupid :
 
  I would like to know who to copy the alpha channel of an image to
  another image.
 
 Simpy select the alpha channel with 'select all' ([CTRL]+A)
 and copy it into the clipboard. Then go to the second image
 where you want to insert the alpha channel, select the image
 ([CTRL]+A again), and copy this selection into an alpha channel
 ('Select  Save to Channel'). Then just select this new alpha
 channel in the 'Layers/Channels' menu and paste the alpha channel
 ([CTRL]+A, [CTRL]+H) from the clipboard into it. That's all.

Thanks for the explanation.

I might have some serious psychotechnic problems but I am not able to
reproduce the scenario you describe.

However, I have finally been able to do what I wanted from the begining : copy 
paste the all 4 channels from an existing image to a new image.

To do so :

  o when creating a new image, choose 

  `advanced options  Fill with : Transparency' 
this is what tells gimp that there will be an alpha channel.

  o then you can go select-all = paste in your new image.

But creating a new image, RGB, filled with white, and then adding an
alpha channel doesn't allow to copy all four channel at once, and leave the 
alpha channel at 255.

Similarly, the equivalent script 

  
  (drawableDst (car (gimp-layer-new imageDst newWidth newHeight RGBA-IMAGE 
dest 100 NORMAL-MODE
  (gimp-drawable-fill drawableDst TRANSPARENT-FILL)
  (gimp-edit-copy (car (gimp-image-get-active-drawable image)))

Does copy the four channels at once, whereas going 

  (drawableDst (car (gimp-layer-new imageDst newWidth newHeight RGBA-IMAGE 
dest 100 NORMAL-MODE
  (gimp-drawable-fill drawableDst TRANSPARENT-FILL)
  (gimp-edit-copy (car (gimp-image-get-active-drawable image)))

Leave also the alpha channel to 255.

I don't understand that behavior. : /




Thank you again for your help, I ll get back to that email if I need
to transfert the alpha channel independently !

Germain
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user