This project has moved and is read-only. For the latest updates, please go here.

problem creating transparent Pngs from PSD

Jan 31, 2015 at 12:30 PM

I was wondering if you could help with an issue I'm having. I'm trying to extract specific layers from a PSD (which may be a transparent layer) but when I export them to PNG all I get is the alpha reversed and the transparent area is everything except the part I want.

I've tried so many options with setting the alpha per layer, setting the background and alpha colors as transaprent but no matter what I do I can't get the area I want.

Here's the code I've got to basically (debug) loop through everything and pull them out as Pngs. I've boiled it back down to basics just so that I don't give you the wrong impression of where I'm going with it.
MagickReadSettings settings = new MagickReadSettings { Format = MagickFormat.Psd };
                using (MagickImageCollection collection = new MagickImageCollection(filename, settings))
                    for (int i = 0; i < collection.Count; i++)
                        var c = collection[i];
                        c.Write(@"C:\development\deploys\test_1\assets\img\" + i + ".png");

I feel like I'm being stupid and missing something obvious but I'm new to ImageMagick so I'm not sure where I'm going wrong.

Here's an example of what the image should be and what I'm getting.

What it should be:

What I'm getting:
Jan 31, 2015 at 12:50 PM
Are you using the latest version of Magick.NET? And can you add a link to your input file so I can try to reproduce this. Feel free to contact me through CodePlex if you don't want to publicly share your image.
Jan 31, 2015 at 1:08 PM

Thanks for such a fast reply. Yeah I updated to the latest version of Magick.NET-x64 a couple of days ago. It's the 2nd PSD I've tried it on so I'm convinced I'm doing something wrong.

Here's the full psd I was working on. Created in Photoshop CC 2014 on the Mac.!10679&authkey=!ACL9c6cfYE461Zw&ithint=file%2cpsd
Jan 31, 2015 at 2:10 PM
Are you sure you upgraded to the latest version? This looks a lot like a bug from the version of Magick.NET. I just tried your code and I am getting the correct output. The expected image from your first post is showing up in frame 34, 38 and 44.
Jan 31, 2015 at 2:23 PM
You know what that did it.

I'm in the VS 2015 preview and package manager is acting a little screwey. The library said but the file on disk said so I removed it completely and re-added it from fresh. Regardless, you are a life saver, thanks you so much and sorry to have bothered you.