如何用c ++读取psd文件的图层! [英] How can I read the layers of a psd file with c++!

查看:535
本文介绍了如何用c ++读取psd文件的图层!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图读取psd文件的图层并将每一层保存为新图片!有没有人能给我一些帮助?

I have tried to read the layers of a psd file and save every layer as a new pic!Is there anyone who can give me some help?

推荐答案

你有什么尝试?我想你需要能够控制Photoshop,或者拥有PSD文件格式并且能够编写代码来阅读和翻译它。
What have you tried ? I guess you need to either be able to control Photoshop, OR have the PSD file format and be able to write code to read and translate it.


我最好的猜测是PSD是构建类似于存档,同时使用xml文件来跟踪其内容。至于层,他们也可以是png文件&不仅取决于文件内容。然而,这只是一个假设。我可能也错了。我正在研究类似的atm。我需要读取psd文件的内容,创建一个xml,它将是文件的摘要,层次描述如position,size和layer name,以便将xml用于自动化图层提取/导出功能。



编辑:可能想看看GIMP。这是一个支持PSD的开源图像编辑器。您可能想尝试在那里获得更多答案。



EDIT2:可能想看看这个: http://www.fileformat.info/format/psd/egff.htm [ ^ ]



有关于psd如何存储数据的说明。事情可能已经过时了。我会使用来自psd的原始数据组合和那里的信息来解析文件。
my best guess would be that the PSD is constructed similar to a archive, while using a xml file to keep track of its content. As for the layers they could just as well be png files & not only, depending on file contents. However this is just a supposition. I might just as well be wrong. I'm kind of working on something similar atm. I need to read the contents of the psd file, create a xml which would be a "summary" of the file, with layer description like "position","size" and "layer name" in order to use that xml for an automated layer extraction/export function.

Might want to have a look at GIMP. That's one opensource image editor which has PSD support. You might want to try and get more answers there.

might wanna take a look at this: http://www.fileformat.info/format/psd/egff.htm[^]

there is a description of how the psd stores data. Thing is it might be outdated. I would use a combo of raw data from the psd and the info there to parse the file.


我试图找到一个lib或一个控件来实现这个功能,但我只得到了libpsd但是我不知道如何使用它!



我也看到导入Adobe Photoshop(.psd)图像但它只是读取图像数据而不是图层和面具信息!!!
I try to find a lib or a control to fulfill this function but I only get libpsd but I don't know how to use it!

I also see "Import Adobe Photoshop (.psd) images" but it just read the Image data not the Layer and mask information!!!


这篇关于如何用c ++读取psd文件的图层!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆