Is there a library in C# that will allow me to read the layers in a photoshop file (PSD) and extract them as transparent images (PNG)?
Photoshop has a batch command that will extract all layers in individual files but there is no choice of transparent PNGs. My goal is to create a small utility program that will create combinations of layers as you like (for example think of creating a card deck).
There's a nice article on CodeProject which might be helpful. And here's a thread on SO discussing PSD file format parsing with C#.
I couldnt find much on this anywhere, but this is how i ended up doing it.
using Photoshop;
Photoshop.PsdFile psd = new Photoshop.PsdFile();
psd.Load(pingTextsPsd);
for (int j = 0; j < psd.Layers.Count; j++)
{
System.Drawing.Image myPsdImage = ImageDecoder.DecodeImage(psd.Layers[j]);
myPsdImage.Save(pingsOutputPath + psd.Layers[j].Name + ".png");
}
i had to downloaded the cs files that Mr Frank Blumenberg did (based on the Endogine engine by Jonas Beckeman), as getting the paintdotnet dll itself wasnt enough.
I believe it was here that i got the cs files.
http://code.google.com/p/skimpt/source/browse/trunk/Skimpt3/Skimpt3/classes/photoshop/?r=72
This should allow you to get the layers..
:-)
This seems to work fine with CS6 files too.
update: a vs2013 website is here: http://goo.gl/H6nWSN.
You can do that with Photoshop COM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With