Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to copy alpha channel
#1
Exclamation 
I have a number of hi-res (600 dpi) images that contain transparency. I want to create a montage of these images but when I copy and paste the original images into the montage base image (which has a transparency channel) the alpha channel is not copied and the transparency is lost.

This not a Windows 10 or 11 issue - the same thing happens in Linux (Fedora 37) as well. Even more confusing is that using the sequence Edit->Paste as->New Image produces a perfect copy with the transparency intact, which would indicate that the image is not altered by the copying process, but something is happening during the paste process.

This is of some urgency as I need to publish this montage ASAP.

Is there a solution in GIMP - or do I need to look elsewhere?
Reply
#2
(08-23-2023, 06:09 AM)dscriven Wrote: I have a number of hi-res (600 dpi) images that contain transparency. I want to create a montage of these images but when I copy and paste the original images into the montage base image (which has a transparency channel) the alpha channel is not copied and the transparency is lost.

This not a Windows 10 or 11 issue - the same thing happens in Linux (Fedora 37) as well. Even more confusing is that using the sequence Edit->Paste as->New Image produces a perfect copy with the transparency intact, which would indicate that the image is not altered by the copying process, but something is happening during the paste process.

This is of some urgency as I need to publish this montage ASAP.

Is there a solution in GIMP - or do I need to look elsewhere?

Works for me...

Do you copy them as new layers? What is the image mode of the target image (full RGB, indexed?). If you chnage Gimp's background color to something recognizable (ie, not white or black), what do you see where the transparency is lost?
Reply
#3
(08-23-2023, 06:35 AM)Ofnuts Wrote:
(08-23-2023, 06:09 AM)dscriven Wrote: I have a number of hi-res (600 dpi) images that contain transparency. I want to create a montage of these images but when I copy and paste the original images into the montage base image (which has a transparency channel) the alpha channel is not copied and the transparency is lost.

This not a Windows 10 or 11 issue - the same thing happens in Linux (Fedora 37) as well. Even more confusing is that using the sequence Edit->Paste as->New Image produces a perfect copy with the transparency intact, which would indicate that the image is not altered by the copying process, but something is happening during the paste process.

This is of some urgency as I need to publish this montage ASAP.

Is there a solution in GIMP - or do I need to look elsewhere?

Works for me...

Do you copy them as new layers? What is the image mode of the target image (full RGB, indexed?). If you chnage Gimp's background color to something recognizable (ie, not white or black), what do you see where the transparency is lost?

The target is full RGB and I've tried pasting them as layers, directly and it makes no difference - the RGB channels are fine and the alpha channel is not copied. I also use ctrl+H to merge the layers. You can see that the alpha is not copied by comparing the channels in the original and the copy. The only effect is that the image becomes paler as the colours are blended - there is a lot of blue green in the images.
Reply
#4
I suppose it all depends on those 600 ppi originals.
However, it might be possible with layer masks. Layer -> Mask -> Add layer mask -> Transfer Alpha channel
Then click - drag that image into the montage background.

40 second (simplified) demo: https://i.imgur.com/5x2H3QE.mp4
Reply
#5
Thanks for your input - it led me to a solution.

It seems that a condition for the transfer of transparency (copying the alpha channel) is that the destination has to be transparent. I was able to correctly copy the images if I cut holes in the background of the montage of the appropriate size revealing the transparent underlayer and then used Edit->Paste into Selection. I didn't need to add a mask to the original image - a simple copy did the trick.

If I'm right about this condition, shouldn't there be a note about it somewhere? I wasted many hours yesterday and today over this (to me, surprising) problem.
Reply
#6
(08-23-2023, 08:01 PM)dscriven Wrote: Thanks for your input - it led me to a solution.

It seems that a condition for the transfer of transparency (copying the alpha channel) is that the destination has to be transparent. I was able to correctly copy the images if I cut holes in the background of the montage of the appropriate size revealing the transparent underlayer and then used Edit->Paste into Selection. I didn't need to add a mask to the original image - a simple copy did the trick.

If I'm right about this condition, shouldn't there be a note about it somewhere? I wasted many hours yesterday and today over this (to me, surprising) problem.

The copy is transparent. If you copy to a new layer, you will see that this layer has transparent pixels where the source has transparent pixels.

But a transparent pixel over a non-transparent background pixel results into a non-transparent pixel. This is Rule One of layer composition in all image editors. Otherwise erasing a bit of a top layer would make everything under it transparent too... In the physical world, when you stack sheets of glass or tracing paper, the result is at least as opaque as the more opaque sheet, not as transparent as the more transparent sheet.
Reply
#7
Thank you for that explanation. I had made the incorrect assumption that the action of Paste was to overwrite the pixels in the target. While this is true for the R, G & B channels, it is not true for the alpha channel. A useful learning experience.
Reply


Forum Jump: