如何指定特定的 Group 3 tiff 压缩?

发布于 2024-07-14 08:43:13 字数 105 浏览 6 评论 0原文

第 3 组压缩有 2 种变体(第 3 组 1D 和第 3 组 2D)。 以 Tiff 格式保存图像时,EncoderValue 枚举中第 3 组只有一个选项。 是否有一个单独的参数来控制这个?

Group 3 compress has 2 variations (Group 3 1D and Group 3 2D). When saving an image in Tiff format, there is only one option for Group 3 in the EncoderValue enumeration. Is there a separate parameter that controls this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静若繁花 2024-07-21 08:43:13

是的。 第 3 组压缩(更准确地说是 CCITT T.4)最常见的用途是用于传真图像。 在这种情况下,图像根据定义是双层(1 位)图像,并且预计会进行一维压缩。 因此,如果您除了将压缩值(标签 259)设置为“2”(对于双层图像)之外不执行任何操作,那么它会被理解为 G3 1 维(修改的霍夫曼)编码。 唯一的其他选项是不压缩 (1) 和包位 (32773)。 基线阅读器应该支持所有三种编码类型,但根据我的经验,许多阅读器不能正确支持 Group III 压缩,尤其是 G32D。

G31D 比 G32D 更容易实现,但效率却不那么高。 G31D 单独存储每条扫描线,而 G32D 存储扫描线之间的差异。 这可能会对定义图像(例如典型的传真图像,其中大部分图像是空白的白纸)所需的数据量产生巨大的影响。

如果要使用G3二维编码,则必须在标签中更加具体。 您必须使用 CCITT 编码来指示 T4 压缩编码(CCITT T.4 是“Group 3”编码标准的“真实”名称)。 要指示这一点,请设置标记 259 == 3。然后设置 T4 选项以指定二维编码。 与标准压缩 (259) 标签等简单标签相比,T4 选项标签(标签 292)有点棘手。 它是用作一组 32 位标志的 LONG 类型。 如果将所有位设置为零,则默认情况下会理解一维编码(与不包含此标签没有什么不同)。

对于二维编码,必须将位 0(低位)设置为 1。(如果您使用多个条带,显然每个条带必须以 1 维扫描线开始。)仅当满足以下条件时,位 1 才设置为 1:使用未压缩模式。 位 2 用于指示是否使用填充位将 EOL 保持在字节边界上(如果为 true,则设置为 1)。 所有其他位默认为零。

请记住,大多数读者无法理解 TIFF 中提供的所有选项。 它是一种极其强大的格式,但这使得在基线 TIFF(可能处理 90% 以上的 TIFF 图像)之外实现它变得很棘手。 如果您使用 Group 3 2 Dimensional 编码,则可以预期大多数专门支持传真图像和医学图像*的阅读器将正确解码图像。 我不希望有更多的事情。

TIFF 不是标准的医学图像格式,但根据我的经验,支持 DICOM 图像和 TIFF 图像的读者通常支持完整的 TIFF 标准

这个答案比我预期的要长。 如果我仍然没有回答您的问题,请在您的原始帖子中进行澄清,我将编辑我的答案。

编辑:您可以在 Adob​​e 开发人员网站上找到 TIFF 标准和其他支持文档。 http://partners.adobe.com/public/developer/tiff/index.html html

Yes. The most common use for Group 3 compression (more accurately CCITT T.4) is for a FAX image. In this case the image is by definition a bi-level (1 bit) image, and 1D compression would be expected. So if you don't do anything other than set the compression value (tag 259) to '2' (for a bi-level image) then it is understood to be G3 1 dimensional (Modified Huffman) encoding. The only other options are no compression (1) and pack-bits (32773). All three encoding types should be supported by baseline readers, but it has been my experience that many readers do not properly support Group III compression, especially G32D.

G31D is much easier to implement than G32D, but not nearly as efficient. G31D stores each scan line individually, while G32D stores the differences between the scan lines. This can make a huge difference in the amount of data required to define an image such as a typical facsimile image where most of the image is blank white paper.

If you want to use G3 2 dimensional coding, you must be more specific in the tags. You must use the CCITT encodings to indicate T4 compression encoding (CCITT T.4 is the "real" name for the "Group 3" encoding standard). To indicate this, set tag 259 == 3. Then set the T4 options to specify 2 dimensional encoding. The T4 options tag (tag 292) is a little tricky compared to the simple tags like the standard compression (259) tag. It is a LONG type used as a set of 32 bit flags. If you leave all the bits set to zero, then 1 dimensional coding is understood by default (no different than not including this tag).

For 2 dimensional coding, you must set bit zero (the low order bit) to 1. (If you are using more than one strip, each strip must obviously start with a 1 dimensional scan line.) Bit 1 is set to 1 only if uncompressed mode is used. Bit 2 is used to indicate if you have used fill bits to keep EOL on a byte boundary (set to 1 if true). All other bits default to zero.

Keep in mind, most readers fail to understand all the options available in TIFF. It is an extremely powerful format, but that makes it tricky to implement beyond the base line TIFF (which probably handles 90%+ of the TIFF images). If you are using Group 3 2 Dimensional coding, you can expect that most readers that specifically support facsimile images and medical images* will properly decode the image. I wouldn't hope for much more than that.

(TIFF is not a standard medical image format, but it is my experience that readers supporting both DICOM images and TIFF images, usually support the full TIFF standard)

This answer is longer than I intended. If I still did not answer your question, please clarify in your original post and I'll edit my answer.

EDIT: You can find the TIFF standard and other supporting documents on the Adobe developer site. http://partners.adobe.com/public/developer/tiff/index.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文