Tiff analyzer

I am writing a program to convert some data, mainly a bunch of Tiff images. Some of the Tiffs have a slight problem with them. They display well in some viewers (Irfanview, the old client system), but not in others (new client system, window view, and fax viewer). I manually looked at the binary data and all the tags look fine. Can someone recommend an application that can analyze it and tell me that if anything is wrong with it?

In addition, for clarity, I only convert data about images that are stored separately in the database and copy images, I myself do not edit the images, so I’m sure that I will not ruin them.

UDPATE: For anyone interested, here are the tags from the good and bad file:

Bad
Tag Type Length Value
256 Image Width SHORT 1 1652
257 Image Length SHORT 1 704
258 bits per sample SHORT 1 1
259 Compression SHORT 1 4
262 Photometric SHORT 1 0
266 Fill out an order SHORT 1 1
273 Band Offset LONG 1 210 (d2 Hex)
274 Orientation SHORT 1 3
277 samples per pixel SHORT 1 1
278 lines per lane SHORT 1,450
279 Account byte accounts LONG 1 7264 (1c60 Hex)
282 X Resolution RATIONAL 1 <194> 200/1 = 200,000
283 Y Resolution RATIONAL 1 <202> 200/1 = 200 000
284 Planar Configuration SHORT 1 1
296 Resolution block SHORT 1 2

Good Quality Tag Type Length Value
254 New type of subfile LONG 1 0 (0 Hex)
256 Image Width SHORT 1 1193
257 Image Length SHORT 1,788
258 bits per sample SHORT 1 1
259 Compression SHORT 1 4
262 Photometric SHORT 1 0
266 Fill out an order SHORT 1 1
270 ASCII Image Description 45 256
273 Strip Shift LONG 1 1118 (45e Hex)
274 Orientation SHORT 1 1
277 samples per pixel SHORT 1 1
278 lines per strip LONG 1,788 (314 Hex)
279 Byte-counter LONG 1 496 (1f0 Hex)
280 Min. Sample value SHORT 1 0
281 Maximum sample value SHORT 1 1
282 X Resolution RATIONAL 1 <301> 200/1 = 200 000
283 Y Resolution RATIONAL 1 <309> 200/1 = 200,000
284 Planar Configuration SHORT 1 1
293 Group 4 Options LONG 1 0 (0 Hex)
296 Resolution block SHORT 1 2

+4
source share
5 answers

This is usually because tiff uses JPEG encoding from the 6.0 standard, which was soon abandoned. Look at tag 259. If it's 6, that's the problem. JPEG files must be encoded using the "newer" scheme, 7. Standard libraries will not read old ones, including those that come with Windows.

You can use libtiff (or any of the libraries or programs that use libtiff, most of them) to read them, but scheme 6 (OJPEG) is intentionally disabled by default in libtiff. You will need to fix and recompile libtiff to enable it. Here is a link with instructions .

+3
source

LibTIFF may be useful. Problems viewing Tiff often arise due to compression used. I would look at that.

+1
source

RowsPerStrip in a bad image is 450, which is less than 704, image length (height). This means that the image should have two stripes. Because of this, StripOffsets and StripByteCounts must have a quantity of two. They indicate the offsets of the file where the strip data is located. When these offsets are absent, only the first band will be decoded.

+1
source

Worth letting ImageMagick go. I understand that TIFF is a rather complex file format and that not everyone fully implements the format.

0
source

TIFF is a very complex format - not only in the wealth of data that it can encode (different pixel formats, different encoders), but also because of the richness of the file format itself (its general structure, which can contain anything). This is basically a garbage dump for every idea we have ever had in visualization. :-)

I would highly recommend the WPF Imaging library from .NET 3.0. Its Tiff decoder, not supporting all pixel formats, is very robust and has a simple interface for accessing all metadata.

0
source

All Articles