【问题标题】:How to save psd layers in png using PSD-plugin for Paint.NET?如何使用 Paint.NET 的 PSD 插件将 psd 图层保存在 png 中?
【发布时间】:2012-01-07 21:16:06
【问题描述】:

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

【问题讨论】:

  • 可能重复:stackoverflow.com/q/629955/635634。该问题最相关的答案基本上是说您的流已损坏。我怀疑System.Drawing.Image 理解 psd 格式。
  • 不是重复的。我正在寻找问题的解决方案,而不是错误解决方案中的错误原因。

标签: c# .net photoshop psd paint.net


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

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

    与保存相同。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-09
      • 2012-06-01
      • 1970-01-01
      • 2011-10-20
      • 2013-10-04
      相关资源
      最近更新 更多