为多页 tiff 设置光度解释标签 [英] Setting the photometric interpretation tag for a multi-page tiff
问题描述
在尝试将多页文档从 tiff 转换为 pdf 时,我遇到了以下问题:
While trying to convert a multipage document from a tiff to a pdf, I encountered the following problem:
↪ tiff2pdf 0271.f1.tiff -o 0271.f1.pdf
tiff2pdf: No support for 0271.f1.tiff with no photometric interpretation tag.
tiff2pdf: An error occurred creating output PDF file.
有人知道是什么原因造成的以及如何解决吗?
Does anybody know what causes this and how to fix it?
推荐答案
这是由于多页 tiff 中的一个或多个页面没有 光度解释标签集.这是必需的标签,因此这意味着您的 tiff 从技术上讲是无效的(尽管我打赌它们无论如何都可以正常工作).
This is caused because one or more of the pages in the multi-page tiff does not have the photometric interpretation tag set. This is a required tag, so that means your tiffs are technically invalid (though I bet they work fine anyway).
要解决此问题,您必须确定没有设置光度解释设置的页面(或多个页面)并进行修复.
To fix this, you must identify the page (or pages) that does not have the photometric interpretation set and fix it.
要识别页面,您可以简单地运行以下内容:
To identify the page, you can simply run something like:
↪ tiffinfo your-file.tiff
这会为您的 tiff 的每一页面吐出信息.对于每个好的页面,您会看到如下内容:
This will spit out the info for every page of your tiff. For each good page, you'll see something like:
TIFF Directory at offset 0x105c0 (67008)
Subfile Type: (0 = 0x0)
Image Width: 1760 Image Length: 2639
Resolution: 300, 300 pixels/inch
Bits/Sample: 1
Compression Scheme: CCITT Group 4
**Photometric Interpretation: min-is-white**
FillOrder: msb-to-lsb
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 2639
Planar Configuration: single image plane
Software: ScanFix(TM) Enhanced ImageGear Version: 11.00.024
DateTime: Mon Oct 31 15:11:07 2005
Artist: 1996-2001 AccuSoft Co., All rights reserved
如果您的页面有问题,它将缺少光度解释
部分,您可以通过以下方式修复它:
If you have a bad page, it'll lack the photometric interpretation
section, and you can fix it with:
↪ tiffset -d $page-number -s 262 0 your-file.tiff
请注意,零值是光度解释键的默认值,即 262.您可以在上面的链接中查看此键的其他值.
Note that the value of zero is the default for the photometric interpretation key, which is 262. You can see the other values for this key at the link above.
如果您的 tiff 有很多页面(就像我的一样),您可能无法通过肉眼轻松识别错误页面.在这种情况下,您可以采用强力方法,将所有页面的光度解释设置为默认值.
If your tiff has a lot of pages (like mine does), you may not be able to easily identify the bad page by eye. In that case, you can take a brute force approach, setting the photometric interpretation for all pages to the default value.
# First, split the tiff into many one-page files
↪ tiffsplit your-file.tiff
# Then, set the photometric interpretation to the default for all pages
↪ find . -name '*.tiff' -exec tiffset -s 262 0 '{}' \;
# Then rejoin the pages
↪ tiffcp *.tiff -o out-file.tiff
大量的虚拟工作,但完成了工作.
Lot of dummy work, but gets the job done.
这篇关于为多页 tiff 设置光度解释标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!