使用Java创建分层Tif以在Photoshop中使用 [英] Create Layered Tif with Java for use in Photoshop

查看:803
本文介绍了使用Java创建分层Tif以在Photoshop中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很有趣用Photoshop创建一个分层的tif,Photoshop会识别这些图层。我能够创建一个多页的tif ,但Photoshop无法识别页面为图层。这些页面可以通过Acrobat查看。任何人都知道Photoshop如何存储tif图层数据以及如何使用Java生成它?

I'm interesting in creating a layered tif with Java in a way that Photoshop will recognize the layers. I was able to create a multi-page tif, but Photoshop does not recognize the pages as layers. The pages are viewable with Acrobat though. Anyone know how Photoshop stores tif layer data and how that could be generated with Java?

谢谢。

推荐答案

我已经为我的 TIFF ImageIO插件,据我所知,Photoshop在TIFF中存储图层信息的方式完全是专有的,不使用标准的TIFF机制,例如利用链接或嵌套IFD的多页文档( 330 / SubIFD )或文件类型( 254 / NewSubFileType )等。

I have researched this for my TIFF ImageIO plugin, and as far as I understand, the way Photoshop stores layer information in TIFFs is completely proprietary and not using standard TIFF mechanisms, like multi-page documents utilizing linked or nested IFDs (330/SubIFD), or file types (254/NewSubFileType), etc.

相反,它将图层信息
与图层图像数据一起存储在 Photoshop特定的TIFF标签; 37724 / ImageSourceData ,其类型为 UNDEFINED (或只是字节)。幸运的是,此标记的内容记录在AdobePhotoshop®
TIFF技术说明

Instead, it stores the layer information, along with the layer image data, in a Photoshop specific TIFF tag; 37724/ImageSourceData, which has type UNDEFINED (or "just bytes"). Luckily, the contents of this tag is documented in Adobe Photoshop® TIFF Technical Notes.

此标记的内容始终以0终止字符串Adobe Photoshop文档数据块。其余内容是各种Photoshop资源,由Photoshop 4字节资源标识符 8BIM 标识,后跟4字节资源密钥和每个资源4字节长度。

The content of this tag will always start with the 0-terminated string "Adobe Photoshop Document Data Block". The rest of the contents is various Photoshop resources, identified by the Photoshop 4 byte resource identifier 8BIM, followed 4 bytes resource key and 4 bytes length for each individual resource.

关于Photoshop图层,此块中有趣的资源是使用资源键 Layr 标识的资源。这与图层和蒙版信息部分在Photoshop文件格式中。

The interesting resource in this block, with regards to Photoshop layers, is the one identified with the resource key Layr. This is the same structure documented in Layer and Mask Information Section in the Photoshop File Format.

还有一个不同的标签, 34377 / Photoshop ,其中包含其他图像资源由Photoshop读写。它也记录在上述文件的图像资源部分中。它确实包含一些有关层的有趣信息,但我不确定你需要编写多少这些信息。您可能需要使用真实的东西进行Photoshop安装和测试。

There's also a different tag, 34377/Photoshop, which contains other image resources read and written by Photoshop. It's also documented in the Image Resources Section of the above document. It does contain some information which is interesting in regards to layers, but I'm not sure how much of this you need to write. You will probably need a Photoshop installation and test using the "real thing".

我有代码读取这两个结构中的 PSD ImageIO插件,这可能值得一看,但是它还不支持写作。

I do have code to read both of these structures in the PSD ImageIO plugin, which might be worth looking at, but it doesn't yet support writing.

当你可以写内容Photoshop TIFF标签时,你应该能够将它传递给 TIFFImageWriter 作为 TIFF IIOMetadata ,编写者会将其与您传递的任何其他元数据和像素数据一起编写。

When you can write the contents Photoshop TIFF tags, you should be able to pass it to the TIFFImageWriter as part of the TIFF IIOMetadata and the writer will write it along with any other metadata and pixel data you pass.

所以,正如你所看到的,这是(大部分)记录的,并且肯定在Java中可行,但仍然不是完全无关紧要的。

So, as you see, this is all (mostly) documented and for sure doable in Java, but still not completely trivial.

这篇关于使用Java创建分层Tif以在Photoshop中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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