views:

265

answers:

2

I've read the TIFF file specification provided by Adobe, but I couldn't find any standards related to:

  1. If it's better/more accepted to put IFDs immediately following the image data they describe/immediately preceding the image data they describe/all together at the top with image data below/etc.

  2. How many rows to put in each strip. Is there generally a good number? If it's a multi-plane image, would it be okay to make each strip just hold all the rows in that particular image plane?

The reason I ask is because I'm programming some Java to make a TIFF file.

+1  A: 

I think it doesn't matter where you put the IFDs provided you follow the spec (because a TIFF reader/writer should be using the spec to find them).

When I wrote some TIFF files, I did:

  1. TIFF file header
  2. Tags for first page
  3. Image for first page
  4. Tags for second page
  5. Image for second page
  6. Etc.
ChrisW
true, but I was just wondering if certain layouts had speed advantages, etc, or if there was a common practice.
hatorade
@hatorade I guess that putting all the tags at the front of the file makes it easier/quicker to *read*: easier to seek to any page. Whereas, instead, writing it as tags/page/tags/page etc makes it easier to *write* one page after another, especially when you don't know (while you're writing it) how many pages there are in total.
ChrisW
A: 

Have you considered finding a bunch of TIFF images off the web from a variety of sites, and then parsing those with the TIFF decompiler you are writing to validate what you are producing? (Or with some other TIFF decompiler?) Would that give you some guidance? If their behaviour is all over the map, you know that it is not critical. If they are consistent, you know you should be consistent with them too.

Jonathan Leffler
Actually I'm writing a Tiff-WRITER, not a READER. So I can't actually do that.
hatorade
OK - but you need to *test* that your generated TIFF files contain the correct information, so you need something that can parse your generated TIFF files. Obviously, eventually, you'll just ship them off to a browser to display, but you will probably find it easier to debug stuff if you have code that can read the file piecemeal and tell you what's in there.
Jonathan Leffler