Author Topic: psd transparency  (Read 1783 times)

kores

  • Guest
psd transparency
« 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

Offline Galfar

  • Administrator
  • Imaging User
  • *****
  • Posts: 312
    • View Profile
    • Galfar's Homepage
Re: psd transparency
« Reply #1 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).

kores

  • Guest
Re: psd transparency
« Reply #2 on: 19 November 2007, 20:31:18 »
I was trying to open the following image: 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.

Code: [Select]
  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.

Offline Galfar

  • Administrator
  • Imaging User
  • *****
  • Posts: 312
    • View Profile
    • Galfar's Homepage
Re: psd transparency
« Reply #3 on: 19 November 2007, 21:23:41 »
Could you please upload it as attachment on the forum? I have problems
downloading it from rapidshare.

Offline kores

  • Imaging User
  • *
  • Posts: 5
    • View Profile
Re: psd transparency
« Reply #4 on: 20 November 2007, 18:46:34 »
Sorry about that. I've attached the file.

Offline Galfar

  • Administrator
  • Imaging User
  • *****
  • Posts: 312
    • View Profile
    • Galfar's Homepage
Re: psd transparency
« Reply #5 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.