This project has moved. For the latest updates, please go here.

Please provide an example on how to create multi-layer PSD files

Aug 27, 2014 at 12:01 AM
Hi folks,

could someone please create a working example on how to create a PSD file that contains multiple layers with alpha channels and transparency?

Thank you very much!

Cheers,
Hendrik
Coordinator
Aug 27, 2014 at 5:18 AM
You could do the following:
using (MagickImageCollection images = new MagickImageCollection())
{
  images.Add(new MagickImage("firstlayer.png"));
  images.Add(new MagickImage("secondlayer.png"));
  images.Write("output.psd");
}
Aug 27, 2014 at 1:20 PM
Have you tried that? Did it work? I'm trying something similar but it doesn't. The first of the two layers I add is always missing.
Coordinator
Aug 27, 2014 at 2:17 PM
Edited Aug 28, 2014 at 5:06 AM
I have not tried the example above becuase this is what I would expect. But it seems the PSD coder wants you to store the layers differently. Your first image should be the 'composite/combined' image. But that does not explain why it does not show up in the result. Are you viewing it in PhotoShop? That might explain why you don't see the first image.
Sep 1, 2014 at 9:56 PM
I'm viewing it in Photoshop, yes. You mean that I should store it like this?
  1. Layer: composite of img1 and img2
  2. Layer: img1
  3. Layer: img2
Coordinator
Sep 2, 2014 at 2:24 PM
Correct. But if you don't need the composite image you could also try to include a 'single color' layer to reduce the size of the file. I have not tried this.