[ACCEPTED]-How can I know if a TIFF image is in the format CCITT T.6(Group 4)?-identification

Accepted answer
Score: 16

You can use this (C#) code example. It returns 3 a value indicating the compression type:

1: no 2 compression
2: CCITT Group 3
3: Facsimile-compatible 1 CCITT Group 3
4: CCITT Group 4 (T.6)
5: LZW

public static int GetCompressionType(Image image)
{
    int compressionTagIndex = Array.IndexOf(image.PropertyIdList, 0x103);
    PropertyItem compressionTag = image.PropertyItems[compressionTagIndex];
    return BitConverter.ToInt16(compressionTag.Value, 0);
}
Score: 10

You can check these links

The tag 259 (hex 48 0x0103) store the info about the Compression 47 method.

--- Compression Tag = 259 (103) Type 46 = word N = 1 Default = 1.

1 = No compression, but 45 pack data into bytes as tightly as possible, with 44 no unused bits except at the end 43 of a row. The bytes are stored as an array of 42 bytes, for BitsPerSample <= 8, word 41 if BitsPerSample > 8 and <= 16, and dword 40 if BitsPerSample > 16 and <= 32. The 39 byte ordering of data >8 bits must 38 be consistent with that specified in the 37 TIFF file header (bytes 0 and 1). Rows 36 are required to begin on byte boundaries.

2 35 = CCITT Group 3 1-Dimensional Modified 34 Huffman run length encoding. See ALGRTHMS.txt 33 BitsPerSample must be 1, since this type 32 of compression is defined only for 31 bilevel images (like FAX images...)

3 = Facsimile-compatible 30 CCITT Group 3, exactly as specified in "Standardization 29 of Group 3 facsimile apparatus for document transmission," Recommendation 28 T.4, Volume VII, Fascicle VII.3, Terminal 27 Equipment and Protocols for Telematic 26 Services, The International Telegraph 25 and Telephone Consultative Committee (CCITT), Geneva, 1985, pages 24 16 through 31. Each strip must begin 23 on a byte boundary. (But recall that 22 an image can be a single strip.) Rows 21 that are not the first row of a strip 20 are not required to begin on a byte 19 boundary. The data is stored as bytes, not 18 words - byte-reversal is not allowed. See 17 the Group3Options field for Group 16 3 options such as 1D vs 2D coding.

4 = Facsimile-compatible CCITT Group 4, exactly 15 as specified in "Facsimile Coding 14 Schemes and Coding Control Functions for 13 Group 4 Facsimile Apparatus," Recommendation 12 T.6, Volume VII, Fascicle VII.3, Terminal 11 Equipment and Protocols for Telematic 10 Services, The International Telegraph 9 and Telephone Consultative Committee (CCITT), Geneva, 1985, pages 8 40 through 48. Each strip must begin 7 on a byte boundary. Rows that are not 6 the first row of a strip are not required 5 to begin on a byte boundary. The data is stored 4 as bytes, not words. See the Group4Options 3 field for Group 4 options.

5 = LZW 2 Compression, for grayscale, mapped color, and 1 full color images.

Score: 4

You can run identify -verbose from the ImageMagick suite on the image. Look 2 for "Compression: Group4" in the 1 output.

Score: 0

UPDATE:

SO, I downloaded the libtiff library from the link 13 I mentioned before, and from what I've seen, you 12 can do the following: (untested)

int isTIFF_T6(const char* filename)
{
TIFF* tif= TIFFOpen(filename,"r");
TIFFDirectory *td = &tif->tif_dir;
if(td->td_compression == COMPRESSION_CCITTFAX4) return 1;
return 0;
}

PREVIOUS: This page has a 11 lot of information about this format and 10 links to some code in C:

Here's an excerpt:

The 9 following paper covers T.4, T.6 and JBIG:

"Review 8 of standards for electronic imaging for 7 facsimile systems" in Journal of 6 Electronic Imaging, Vol. 1, No. 1, pp. 5-21, January 5 1992.

Source code can be obtained as part 4 of a TIFF toolkit - TIFF image compression 3 techniques for binary images include CCITT 2 T.4 and T.6:

ftp://ftp.sgi.com/graphics/tiff/tiff-v3.4beta035-tar.gz Contact: sam@engr.sgi.com

Read 1 more: http://www.faqs.org/faqs/compression-faq/part1/section-16.html#ixzz0TYLGKnHI

More Related questions