Vampyre Imaging Library Forum

Imaging Category => Help & Questions => Topic started by: kores on 18 November 2007, 20:39:46

Title: psd transparency
Post by: kores on 18 November 2007, 20:39:46
Hello,

I'm trying to open a psd file, but the transparency information is always lost.
Is this the "normal" behavior or am I doing something wrong?

Thank you
Title: Re: psd transparency
Post by: Galfar on 19 November 2007, 00:20:11
Could you post some non working image here please?
PSD loader only reads raster data, no layers, objects, etc.
Transparency stored in alpha channel works ok (tested with CS2).
Title: Re: psd transparency
Post by: kores on 19 November 2007, 20:31:18
I was trying to open the following image: http://rapidshare.com/files/70858462/test.psd.html (http://rapidshare.com/files/70858462/test.psd.html)
In Photoshop it shows a transparent background. But when I open it it has a completely white background.


  image := TSingleImage.Create;
  image.Format := ifA8R8G8B8;
  image.LoadFromFile('test.psd');

  p := Image.ScanLine[j]; //   p: PRGBQuad;


p.rgbReserved is always 255. When i see that in Photoshop it has transparency information I would expect to be able to get it programatically.
Is there a way to get the transparency, or I must live with the white background  :) ?

Thank you.
Title: Re: psd transparency
Post by: Galfar on 19 November 2007, 21:23:41
Could you please upload it as attachment on the forum? I have problems
downloading it from rapidshare.
Title: Re: psd transparency
Post by: kores on 20 November 2007, 18:46:34
Sorry about that. I've attached the file.
Title: Re: psd transparency
Post by: Galfar on 20 November 2007, 22:27:36
As I wrote before Imaging's PSD loader doesn't read layer information which is how transparency is stored in your image. You need to get your transparency into alpha channel (and set image mode from CMYK to RGB as Imaging currently doesn't read alpha channel of CMYK images).

How I made attached Imaging compatible transparent PSD from your image:
1. 'Merge Visible' the two image layers
2. 'Select Layer Transparency' on merged layer
3. Set 'Image->Mode' to RGB
4. 'Save selection as channel' which created alpha channel with proper transparency
5. Finally save the file

Complicated, but at least both PSD layers and native CMYK data formats will be supported in
upcoming Imaging 0.3x.