How can I know if a TIFF image is in the format CCITT T.6(Group 4)?
Asked Answered
F

4

11

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

Faun answered 10/10, 2009 at 16:47 Comment(0)
T
16

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

1: no compression
2: CCITT Group 3
3: Facsimile-compatible 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);
}
Tabulate answered 13/10, 2009 at 15:46 Comment(0)
R
10

You can check these links

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

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

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

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

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

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

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

Recalesce answered 10/10, 2009 at 17:31 Comment(0)
R
4

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

Rame answered 10/10, 2009 at 17:20 Comment(0)
L
0

UPDATE:

SO, I downloaded the libtiff library from the link I mentioned before, and from what I've seen, you 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 lot of information about this format and links to some code in C:

Here's an excerpt:

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

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

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

ftp://ftp.sgi.com/graphics/tiff/tiff-v3.4beta035-tar.gz Contact: [email protected]

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

Latifundium answered 10/10, 2009 at 16:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.