2009年6月8日月曜日

TIFFファイル処理と表示の非常識(2)

上記のような画像をIrfanViewなどの専用の画像編集ツールで確認できる。
(画像処理専門のSnowboundでも、確認できる)

3.なぜ上記条件の白黒2色のTIFF_G3_FAXとTIFF_G4_FAXがこういう
ことが起こるのか?
ひとこと言えば、色表示定義用の属性が2つあるのせい。
下記は、具体的な説明:
・CCITTフォーマットが自分の色定義属性を持っている、該当属性
が白=0か黒=0か定義しる
・TIFF_G3_FAXとTIFF_G4_FAXがCCITTをベースに定義した
TIFFファイルです。しかし、全てのTIFFファイルに色表示定義の
タグ「PhotometricInterpretation」もある
・問題になったのは、このようなTIFF画像をどういる基準色で
表示するかつまり、CCITTの定義に従うか、TIFFの定義に従うか

この問題を解決するため、TIFF画像処理のチームは、下記の規約
を勝手に決めた。
①TIFF_G3_FAX/TIFF_G4_FAX、かつ、PhotometricInterpretation =0:
CCITTが定義した白黒色表示の基準に従って、画像を表示する

②TIFF_G3_FAX/TIFF_G4_FAX、かつ、PhotometricInterpretation =1:
CCITTが定義した白黒色表示の基準を逆して、画像を表示する
すなわち、CCITTが定義した白黒色表示の基準は、白=0であれば、
この場合、画像が黒=0で表示する
これは、画像のWindows表示とSnowboundやIrfanViewで表示した結果が
逆になった原因。

めちゃくちゃかもしれないが、TIFFのSpecification定義の混乱が原因
でしょう。だが、もうきめたものだから、このような変なTIFFファイルが
消えない限り、このルールに従わなければならないでしょう。
本当に悲しい~~~:(

補足:
該当問題に当たっている英語の説明:
An encoded CCITT string is self-photometric,
defined in terms of white and black runs. Yet TIFF defines a tag
called PhotometricInterpretation that also purports to define
what is white and what is black. Somewhat arbitrarily, we adopt
the following convention:

The "normal" PhotometricInterpretation for bilevel CCITT
compressed data is WhiteIsZero. In this case, the CCITT "white"
runs are to be interpreted as white, and the CCITT "black" runs
are to be interpreted as black.
However, if the PhotometricInterpretation is BlackIsZero, the
TIFF reader must reverse the meaning of white and black when
displaying and printing the image.

0 件のコメント: