读取 PSD 文件格式
我想知道这是否可能。 我有一个应用程序,当您右键单击文件时,它会添加上下文菜单。 一切正常,但我想做的是:
如果文件是 PSD,那么我希望程序提取图像。 是否可以在不安装 Photoshop 的情况下完成此操作?
基本上我希望用户右键单击并单击“图像”,这将为他们保存文件的 .jpg。
编辑:将使用c# 谢谢
I wonder if this is even possible. I have an application that adds a context menu when you right click a file. It all works fine but here is what I'd like to do:
If the file is a PSD then I want the program to extract the image. Is this possible to do without having Photoshop installed?
Basically I want the user to right click and click "image" which would save a .jpg of the file for them.
edit: will be using c#
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
这家伙做得更容易:
http://www.codeproject.com/KB/graphics/ simplepsd.aspx
带有 C# 库和示例项目。
我已经尝试过使用 PS2 文件并且工作正常。
This guy do it easier:
http://www.codeproject.com/KB/graphics/simplepsd.aspx
With a C# library and a sample project.
I've tried with PS2 files and works ok.
我编写了一个 PSD 解析器,它从所有版本的 PSD 和 PSB 中提取光栅格式图层。 http://www.telegraphics.com.au/svn/psdparse/trunk
I have written a PSD parser which extracts raster format layers from all versions of PSD and PSB. http://www.telegraphics.com.au/svn/psdparse/trunk
您可以使用 GroupDocs.Viewer for .NET API 将 PSD 文件呈现为图像(JPG、 PNG、BMP)在您的应用程序中使用几行代码。
C#
有关更多详细信息和示例代码,请访问 此处。
披露:我在 GroupDocs 担任开发人员传播者。
You can use GroupDocs.Viewer for .NET API to render your PSD files as images (JPG, PNG, BMP) in your application using a few lines of code.
C#
For more details and sample code, please visit here.
Disclosure: I work as a Developer Evangelist at GroupDocs.
对于现在正在阅读本文的人:已接受答案的链接似乎不再起作用(至少对我来说)。 会在那里添加评论,但还不允许发表评论 - 因此我添加了一个新答案。
您可以在其中找到 Paint.Net psdplugin 代码的工作链接: https://github.com/PsdPlugin/PsdPlugin
For people who are reading this now: the link from accepted answer doesn't seem to work anymore (at least for me). Would add a comment there, but not allowed to comment yet - hence I'm adding a new answer.
The working link where you can find the psdplugin code for Paint.Net: https://github.com/PsdPlugin/PsdPlugin
这是我自己的 psd 解析器和导出器:
http://papirosnik.info/psdsplit/。
它允许正确解析带有 rgb 颜色 8、16 和 32 位通道的 psd,处理用户蒙版,将选定的图层导出为 jpeg、png、jng、bmp、tiff; 创建导出图层和组的 xml 布局,并根据给定图层创建纹理图集和动画集。
它完全是用 C# 编写的。 如果您希望其来源,请通过应用程序中“关于”对话框上的支持链接通知我。
Here is my own psd parser and exporter:
http://papirosnik.info/psdsplit/.
It allows to correctly parse psd with rgb color 8, 16- and 32-bit for channel, process user masks, export selected layers into jpeg, png, jng, bmp, tiff; create xml layout of exported layers and groups and also create a texture atlas and animations set from given layers.
It's entirely written in C#. If you want its sources inform me via support link on About dialog in the application.
ImageMagick.NET - http://imagemagick.codeplex.com/ - 是 0xA3 给出的链接的更高版本,语法略有不同。 (注意,这未经测试):
ImageMagick.NET - http://imagemagick.codeplex.com/ - is the later version of the link 0xA3 gave, with some slightly different syntax. (Note, this is untested):
我从 psd 中提取了工作。 在这里查看我的答案
如何提取图层来自 Photoshop 文件? C#
可能会帮助别人。
I got extraction from psd working. see my answer here
How to extract layers from a Photoshop file? C#
may help someone else.
FastStone 非常有效地做到了这一点。
他们没有可用的图书馆,但我想你可以联系他们,看看他们是否可以提供帮助。
查看他们的网站:http://www.faststone.org/download.htm
FastStone does this pretty efficiently.
They do not have their libraries availaible, but I guess you can contact them and see if they can help.
Check out their website: http://www.faststone.org/download.htm
我使用 Aspose 的成像组件取得了巨大成功,该组件无需 Photoshop 即可加载和保存 PSD 文件:https:// products.aspose.com/imaging/net
I've had great success with Aspose's Imaging component which can load and save PSD files without Photoshop: https://products.aspose.com/imaging/net
ImageMagick 库(提供 C# 的绑定)也支持 PSD 格式。 它们可能比使用 Paint.NET 代码更容易上手,并且还附带相当免费(类似 BSD)的许可证。
一个简单的示例(位于http://midimick.com/magicknet/magickDoc.html)使用MagickNet 看起来像这样:
注意:MagickNet 已移至 http://www.codeproject.com /KB/dotnet/ImageMagick_in_VBNET.aspx
The ImageMagick libraries (which provide bindings for C#) also support the PSD format. They might be easier to get started with than getting into the Paint.NET code and also come with a quite free (BSD-like) license.
A simple sample (found at http://midimick.com/magicknet/magickDoc.html) using MagickNet would look like this:
Note: MagickNet has moved to http://www.codeproject.com/KB/dotnet/ImageMagick_in_VBNET.aspx
嗯,Paint.NET 有一个 PSD 插件,我认为它是开源的,初学者可能想看一下:
http://frankblumenberg.de/doku/doku.php?id=paintnet:psdplugin#download
Well, there's a PSD plugin for Paint.NET which I think is Open-Source which you might want to take a look at for starters:
http://frankblumenberg.de/doku/doku.php?id=paintnet:psdplugin#download