如何使用 Paint.NET 的 PSD 插件将 PSD 图层保存为 png?
如何使用 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(流, true, true); 抛出“参数无效”异常。
通过 C#/C++ 的任何其他解决方案也是可以接受的。提前致谢。
How to save PSD layers in png using PSD-plugin for Paint.NET?
Trying to do this way:
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);
But the line
img = Image.FromStream(stream, true, true);
throws "Parameter is not valid" exception.
Any other solutions via C#/C++ are also acceptable. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否想过询问 PSD 插件的作者?顺便说一句,Paint.NET 未获得作为 SDK 的许可,仅作为应用程序使用。
Have you thought about asking the author of the PSD plugin? Paint.NET isn't licensed for use as an SDK, by the way, only as an application.
第一个解决方案不再适用于最新版本,请改用:
与保存相同。
The first solution does not work anymore with the latest version, use instead:
Same with saving.