Hello, recently when using GIMP scripts to merge multiple TIF files into a PSD file, I found that the alpha channel was missing. These TIF files themselves have an alpha channel, but the resulting PSD file does not include it. I’m quite confused and look forward to your help.THX!
I can’t reproduce this. Can you tell us a list of steps to follow to reproduce the problem, and/or provide sample files?
Sorry for the slow reply, I had something on over the weekend. I might not have explained it clearly: the generated PSD file can display the alpha channel when opened with GIMP, but I can’t see the alpha channel when using Photoshop CS. I’ll share the code implementation process and example files later. Thank you very much!
Here is my PY code and sample images, thank you.
Why do you expect an alpha channel(*)? You are stacking completely opaque layers! The only layer that has some transparent pixels is the TGA one, but you put it over and under totally opaque pixels. And what it the purpose of the material
layer?
Also:
- Take a look at
pdb.gimp_file_load_layer(image, filename)
that can both speed up and simplify your code. - By hard-coding
0
as a layer mode ingimp_layer_new()
you are actually usingLAYER_MODE_NORMAL_LEGACY
and notLAYER_MODE_NORMAL
- If you want to use a layer as a mask for other layers you can put it under other layer and set
pdb.gimp_layer_set_composite_mode(layer, LAYER_COMPOSITE_CLIP_TO-BACKDROP)
on all layers above it, or put all these layers in a group (except the mask one) and set the group toLAYER_COMPOSITE_CLIP_TO-BACKDROP
.
(*) I assume that this means “some non-transparent pixels” because when I open composite.psd
in Gimp all layers have an alpha channel.
At that time, I didn’t find a more suitable set of images, so I used a blank alpha channel for demonstration. The composite PSD file can show the alpha channel when opened with GIMP, but it loses that alpha channel when opened with PS CS.
If I change your images so that the resulting image has transparent pixels, then the resulting PSD has an alpha channel:
>file composite*
composite.psd: Adobe Photoshop Image, 3000 x 4000, RGB, 3x 16-bit channels
composite-test.psd: Adobe Photoshop Image, 3000 x 4000, RGBA, 4x 16-bit channels
Thank you very much! After using pdb.gimp_file_load_layer, the speed has indeed improved a bit! However, I tried the method you provided and it still didn’t generate an RGBA PSD file. How did you do it? Could you share your method?
I used your original code but with different input: a pair of image that had semi-overlapping “holes” so that the composition still has transparent pixels.
But as I said, something detects that all resulting pixels are opaque pixels and removes the alpha channel.
Btw, the way, in your PSD image, the TGA layer still has transparent pixels, so the alpha channels of layers is not lost. So perhaps there is no alpha channel shown in PS because PS itself sees the whole image as opaque. What happens if you mask all layers and keep only the TGA layer visible? Do you see an alpha channel in the Channels list then?
This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.