1

如何使用 Paint.NET 的 PSD 插件将 PSD 图层保存在 png 中?

尝试这样做:

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++ 的任何其他解决方案也是可以接受的。提前致谢。

4

2 回答 2

0

有没有想过问问PSD插件的作者?顺便说一下,Paint.NET 没有被许可用作 SDK,只能用作应用程序。

于 2012-03-22T17:12:27.780 回答
0

第一个解决方案不再适用于最新版本,请改用:

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);

与储蓄相同。

于 2015-01-22T17:01:30.680 回答