views:

594

answers:

2

Group 3 compress has 2 variations (Group 3 1D and Group 3 2D). When saving an image in Tiff format, there is only one option for Group 3 in the EncoderValue enumeration. Is there a separate parameter that controls this?

+1  A: 

Yes. The most common use for Group 3 compression (more accurately CCITT T.4) is for a FAX image. In this case the image is by definition a bi-level (1 bit) image, and 1D compression would be expected. So if you don't do anything other than set the compression value (tag 259) to '2' (for a bi-level image) then it is understood to be G3 1 dimensional (Modified Huffman) encoding. The only other options are no compression (1) and pack-bits (32773). All three encoding types should be supported by baseline readers, but it has been my experience that many readers do not properly support Group III compression, especially G32D.

G31D is much easier to implement than G32D, but not nearly as efficient. G31D stores each scan line individually, while G32D stores the differences between the scan lines. This can make a huge difference in the amount of data required to define an image such as a typical facsimile image where most of the image is blank white paper.

If you want to use G3 2 dimensional coding, you must be more specific in the tags. You must use the CCITT encodings to indicate T4 compression encoding (CCITT T.4 is the "real" name for the "Group 3" encoding standard). To indicate this, set tag 259 == 3. Then set the T4 options to specify 2 dimensional encoding. The T4 options tag (tag 292) is a little tricky compared to the simple tags like the standard compression (259) tag. It is a LONG type used as a set of 32 bit flags. If you leave all the bits set to zero, then 1 dimensional coding is understood by default (no different than not including this tag).

For 2 dimensional coding, you must set bit zero (the low order bit) to 1. (If you are using more than one strip, each strip must obviously start with a 1 dimensional scan line.) Bit 1 is set to 1 only if uncompressed mode is used. Bit 2 is used to indicate if you have used fill bits to keep EOL on a byte boundary (set to 1 if true). All other bits default to zero.

Keep in mind, most readers fail to understand all the options available in TIFF. It is an extremely powerful format, but that makes it tricky to implement beyond the base line TIFF (which probably handles 90%+ of the TIFF images). If you are using Group 3 2 Dimensional coding, you can expect that most readers that specifically support facsimile images and medical images* will properly decode the image. I wouldn't hope for much more than that.

(TIFF is not a standard medical image format, but it is my experience that readers supporting both DICOM images and TIFF images, usually support the full TIFF standard)

This answer is longer than I intended. If I still did not answer your question, please clarify in your original post and I'll edit my answer.

EDIT: You can find the TIFF standard and other supporting documents on the Adobe developer site. http://partners.adobe.com/public/developer/tiff/index.html

TMarshall
A: 

@TMarshall Where do I find detailed information about what each of the 32 bits in tag 292 (T4 options) are all about? Is there any bit on tag 292 (T4 options) which instructs the encoder to not spread rows into multiple strips and set FillOrder to 1 (0x0100)? I have a bitonal 2347 pixels (11.50 inch) x 1728 pixels (8.82 inch) and need its content to fit in only one strip per page. Is it possible to set tag 278 (RowsPerStrip) to 2347 (0x2B09), before saving the bitmap object to a tiff file so that encoder uses information from tag 278 (RowsPerStrip) during encoding process?

Thanks in advance.

guercheLE
It's all in the TIFF standard(s). The best place to find them is the Adobe developer site. http://partners.adobe.com/public/developer/tiff/index.html
TMarshall