如何使用Paint.NET的PSD插件在png中保存PSD图层?
尝试这样做:
System.Drawing.Image img;
var stream = new System.IO.MemoryStream();
var BRW = new PhotoshopFile.BinaryReverseWriter(stream);
var psd = new PhotoshopFile.PsdFile();
psd.Load("c:\\1.psd");
psd.Layers[0].Save(BRW);
stream.Seek(0, System.IO.SeekOrigin.Begin);
img = System.Drawing.Image.FromStream(stream, true, true);
img.Save("c:\\1.png", System.Drawing.Imaging.ImageFormat.Png);
但是行img = Image.FromStream(stream,true,true);引发“参数无效”异常。
也可以接受通过C#/ C ++的任何其他解决方案。预先感谢。
您是否考虑过询问PSD插件的作者?顺便说一下,Paint.NET未被许可用作SDK,而只能作为应用程序使用。
第一个解决方案不适用于最新版本,请改用:
var psd = new PhotoshopFile.PsdFile("YourPhotoshop Path as string", Encoding.ASCII);
// or
var psd = new PhotoshopFile.PsdFile("Your Photoshop File Path as string", Encoding.Default);
与保存相同。