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

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

问题描述

我对使用 Java 以 Photoshop 识别图层的方式创建分层 tif 很感兴趣.我能够创建多页 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(或仅字节").幸运的是,此标签的内容记录在 Adobe Photoshop® 中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 Document Data Block" 开头.其余内容是各种 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".

我确实在 阅读这两种结构的代码="nofollow noreferrer">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 标签的内容时,您应该能够将其作为 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天全站免登陆