我想知道这是否可能。我有一个应用程序,当您右键单击文件时添加上下文菜单。这一切都很好,但这是我想做的事情:
如果文件是PSD,那么我希望程序提取图像。如果没有安装Photoshop,这可能吗?
基本上我希望用户右键单击并单击“图像”,这将为他们保存文件的.jpg。
编辑:将使用c# 感谢
答案 0 :(得分:20)
ImageMagick个库(提供bindings for C#)也支持PSD格式。它们可能比开始使用Paint.NET代码更容易上手,并且还提供了一个非常免费(类似BSD)的许可证。
使用MagickNet在http://midimick.com/magicknet/magickDoc.html) 找到的简单示例如下所示:
using System;
static void Main(string[] args)
{
MagickNet.Magick.Init();
MagicNet.Image img = new MagicNet.Image("file.psd");
img.Resize(System.Drawing.Size(100,100));
img.Write("newFile.png");
MagickNet.Magick.Term();
}
注意:MagickNet已移至http://www.codeproject.com/KB/dotnet/ImageMagick_in_VBNET.aspx
答案 1 :(得分:18)
嗯,有一个用于Paint.NET的PSD插件,我认为它是Open-Source,你可能想看看初学者:
http://frankblumenberg.de/doku/doku.php?id=paintnet:psdplugin#download
答案 2 :(得分:4)
答案 3 :(得分:4)
我编写了一个PSD解析器,它从PSD和PSB的所有版本中提取栅格格式图层。 http://www.telegraphics.com.au/svn/psdparse/trunk
答案 4 :(得分:2)
这是我自己的psd解析器和导出器: http://papirosnik.info/psdsplit/。 它允许正确解析psd与rgb颜色8,16和32位用于通道,处理用户掩码,将所选层导出为jpeg,png,jng,bmp,tiff;创建导出的图层和组的xml布局,还可以创建从给定图层设置的纹理图集和动画。 它完全用C#编写。如果您希望其来源通过应用程序中的关于对话框的支持链接通知我。
答案 5 :(得分:1)
FastStone非常有效地完成了这项工作。 他们没有可用的库,但我想你可以联系他们,看看他们是否可以提供帮助。
答案 6 :(得分:1)
ImageMagick.NET - http://imagemagick.codeplex.com/ - 是0xA3给出的链接的更高版本,语法略有不同。 (注意,这是未经测试的):
using ImageMagickNET;
public void Test() {
MagickNet.InitializeMagick();
ImageMagickNET.Image img = new ImageMagickNET.Image("file.psd");
img.Resize(new Geometry(100, 100, 0, 0, false, false);
img.Write("newFile.png");
}
答案 7 :(得分:1)
答案 8 :(得分:1)
您可以使用几行代码使用GroupDocs.Viewer for .NET API在您的应用程序中将PSD文件呈现为图像(JPG,PNG,BMP)。
C#
<table class="table">
<tbody>
<tr>
<td class="table-head-text top-table-text">Assets</td>
<td class="table-year-1 bold">2018</td>
<td class="spacer"> </td>
<td class="table-year-2 bold">2017</td>
</tr>
<tr>
<td>Cash & Due From Banks</td>
<td class="table-year-1">$149,753</td>
<td class="spacer"> </td>
<td class="table-year-2">$77,515</td>
</tr>
<tr>
<td>Investment Securities</td>
<td class="table-year-1">$929,432</td>
<td class="spacer"> </td>
<td class="table-year-2">$830,878</td>
</tr>
<tr>
<td>Loans (net of valuation reserve)<br />
($28,582 in 2018 & $27,063 in 2017)</td>
<td class="table-year-1">$1,902,960</td>
<td class="spacer"> </td>
<td class="table-year-2">$1,813,062</td>
</tr>
<tr>
<td>Federal Funds Sold</td>
<td class="table-year-1">$0</td>
<td class="spacer"> </td>
<td class="table-year-2">$0</td>
</tr>
<tr>
<td>Premises & Equipment</td>
<td class="table-year-1">$49,956</td>
<td class="spacer"> </td>
<td class="table-year-2">$46,666</td>
</tr>
<tr>
<td>Accured Income</td>
<td class="table-year-1">$12,652</td>
<td class="spacer"> </td>
<td class="table-year-2">$12,589</td>
</tr>
<tr>
<td>Other Assets</td>
<td class="table-year-1">$111,287</td>
<td class="spacer"> </td>
<td class="table-year-2">$102,413</td>
</tr>
<tr class="tr-border">
<td class="table-head-text">Total Assets</td>
<td class="table-year-1 bold line-break">$3,156,040</td>
<td class="spacer"> </td>
<td class="table-year-2 bold line-break">$2,883,123</td>
</tr>
<tr>
<td class="table-head-text top-table-text">Liabilities &
Capital Funds</td>
<td class="table-year-1 line-break-2"> </td>
<td class="spacer"> </td>
<td class="table-year-2 line-break-2"> </td>
</tr>
<tr>
<td>Non-Interest Bearing Deposits</td>
<td class="table-year-1">$952,623</td>
<td class="spacer"> </td>
<td class="table-year-2">$894,075</td>
</tr>
<tr>
<td>Non-Interest Bearing Public Deposits</td>
<td class="table-year-1">$190,104</td>
<td class="spacer"> </td>
<td class="table-year-2">$179,582</td>
</tr>
<tr>
<td>Interest Bearing Deposits</td>
<td class="table-year-1">$1,344,490</td>
<td class="spacer"> </td>
<td class="table-year-2">$1,194,226</td>
</tr>
<tr>
<td>Interest Bearing Public Deposits</td>
<td class="table-year-1">$370,094</td>
<td class="spacer"> </td>
<td class="table-year-2">$274,994</td>
</tr>
<tr class="tr-border">
<td class="table-head-text">Total Deposits</td>
<td class="table-year-1 bold line-break">$2,857,311</td>
<td class="spacer"> </td>
<td class="table-year-2 bold line-break">$2,542,877</td>
</tr>
<tr>
<td>Other Liabilities</td>
<td class="table-year-1 line-break-2">$22,497</td>
<td class="spacer"> </td>
<td class="table-year-2 line-break-2">$22,954</td>
</tr>
<tr>
<td>Fed Funds Purchase & Other Borrowed Money</td>
<td class="table-year-1">$0</td>
<td class="spacer"> </td>
<td class="table-year-2">$63,394</td>
</tr>
<tr class="tr-border">
<td class="table-head-text">Total Liabilities</td>
<td class="table-year-1 bold line-break">$2,879,808</td>
<td class="spacer"> </td>
<td class="table-year-2 bold line-break">$2,629,225</td>
</tr>
<tr>
<td class="table-head-text top-table-text">Capital
Accounts</td>
<td class="table-year-1 line-break-2"> </td>
<td class="spacer"> </td>
<td class="table-year-2 line-break-2"> </td>
</tr>
<tr>
<td>Capital Stock</td>
<td class="table-year-1">$2,500</td>
<td class="spacer"> </td>
<td class="table-year-2">$2,500</td>
</tr>
<tr>
<td>Surplus</td>
<td class="table-year-1">$100,943</td>
<td class="spacer"> </td>
<td class="table-year-2">$79,188</td>
</tr>
<tr>
<td>Undivided Profits</td>
<td class="table-year-1">$188,173</td>
<td class="spacer"> </td>
<td class="table-year-2">$177,768</td>
</tr>
<tr>
<td>Unrealized Gain <span class="loss-span">(Loss)
Securities</span></td>
<td class="table-year-1">($15,384)</td>
<td class="spacer"> </td>
<td class="table-year-2">($5,558)</td>
</tr>
<tr class="tr-border">
<td class="table-head-text">Total Capital Accounts</td>
<td class="table-year-1 bold line-break">$276,232</td>
<td class="spacer"> </td>
<td class="table-year-2 bold line-break">$253,898</td>
</tr>
<tr class="tr-border">
<td class="table-head-text bk">Total Liabilities &
Capital Accounts</td>
<td class="table-year-1 bold line-break-2">$3,156,040</td>
<td class="spacer"> </td>
<td class="table-year-2 bold line-break-2">$2,883,123</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
有关更多详细信息和示例代码,请访问here。 披露:我是GroupDocs的一名开发人员。
答案 9 :(得分:0)
我使用Aspose的成像组件取得了巨大成功,该组件无需Photoshop即可加载和保存PSD文件:https://products.aspose.com/imaging/net
答案 10 :(得分:0)
对于现在正在阅读此书的人:来自已接受答案的链接似乎不再起作用(至少对我而言)。会在此处添加评论,但尚未发表评论-因此,我要添加一个新答案。
可以在其中找到Paint.Net的psdplugin代码的工作链接:https://github.com/PsdPlugin/PsdPlugin