Those TIFF files

While releasing and compiling Prima 1.33 for 5 different perls, I'm taking a moment to send a couple of warm ones towards the TIFF specification. Prima originally was written to be used in (among other) software for microscopy recordings, and recently a former colleague sent me a bunch of tiffs no software could read. Heh, here's the challenge, thought naive me. Indeed, these were 10-bit grayscale tiff bitmaps, and as bit-shuffling was some long time ago an interesting topic for me, I've implemented these in Prima's tiff codec. Everyone's happy.

But that got me curious, what else these tiff files can that Prima cannot? I've found some test tiffs and oh horror horror, I better wouldn't. So many of them not only Prima cannot, but almost noone else can load or display. The features include: nonstandard bit depths (13-bit images cool huh? not just 13 significant bits in every 2 bytes, literally 8 pixels per 13 bytes). Signed and unsigned integer pixels. MSB and LSB. 0 is black and 0 is white. Fax tiffs where 2 horizontal pixels occupy same place as 1 vertical. ieee64 float and complex pixels. Logarithmic color ranges. Color palettes for images with greater than 8-bit pixels (i've seen a 16-bit image where each pixel is a palette entry; the palette size is 3*64K bytes). Scanline-based encoding and tiled (chessboard-like) encoding. RGBA memory layout where these can be 4-pixels, and can be 4-scanlines too. OMG WHY OH WHY??!!!! Well yes tiffs are far from being popular these days, and I see a reason for it. Feature bloat killed the video star :)

Well anyway, I had fun coding some of these pecularities, and if you ever need to decrypt some obscure tiff no other software can, hope you'll have fun too )

3 Comments

Thank you for sharing your story about the tiff images.

I recently discovered a few dozen tiff images that I could not process with any software I had (on Ubuntu). I tried libtiff via Imager and Image::Magick and couldn't get anywhere, and also the built-in image-viewer program for Ubuntu - "Eye of Gnome" (eog) couldn't open them.

I thought they were somehow corrupted. Your story makes me think that the tiff images were just more exotic than "normal" tiff images.

@Dmitry if I can find them, I'll try that.

Leave a comment

About Dmitry Karasik

user-pic I blog about Perl.