2013.09.22 13:53 "[Tiff] Use libtiff to decode CCITT from pdf...", by Wizard Coder

Hi,

I see that libtiff can be use to transcode CCITT data from pdf to a tiff file (* see at the end)

I take the sample apply compression modification remove TIFFTAG_T4OPTIONS, it create an error message...

My problem is to map decode parameter from pdf to tiff field

My suppositions are:

/Width - From pdf base header.
    Base10 value    TIFFTAG_IMAGEWIDTH    = value
   
/Height - From pdf base header.  
    Base 10 value    TIFFTAG_IMAGELENGTH    = value

/Rows - From DecodeParms.
    Vase 10 value    TIFFTAG_ROWSPERSTRIP   = value

/BlackIs1 - From DecodeParms.       
    true    TIFFTAG_PHOTOMETRIC     = PHOTOMETRIC_MINISWHITE
    false    TIFFTAG_PHOTOMETRIC     = PHOTOMETRIC_MINISBLACK
   
/EndOfBlock- From DecodeParms.   
    true    TIFFTAG_FAXMODE   |= FAXMODE_CLASSIC
    false    TIFFTAG_FAXMODE   |= AXMODE_NORTC
       
/EncodedByteAlign- From DecodeParms.
    true    TIFFTAG_FAXMODE    |= FAXMODE_BYTEALIGN
    false    TIFFTAG_FAXMODE    |= 0

/EndOfLine - From DecodeParms.
    true   ?
    false   ?

/K - From DecodeParms.
    0        TIFFTAG_COMPRESSION    = COMPRESSION_CCITTRLE
    <1     ?
    >1      ?      

// Always set.
TIFFTAG_BITSPERSAMPLE    =1
TIFFTAG_SAMPLESPERPIXEL  = 1

TIFFTAG_PLANARCONFIG    =PLANARCONFIG_CONTIG

TIFFWriteRawStrip ( image, 0, "MyBuffer", "MyBuffer size - /Length from base header" );

Where can i found full information to use libtiff to decode CCITT from PDF?

Can you help me?

Thanks for your help,

WCoder

* On a previous thread: http://maptools-org.996276.n3.nabble.com/CCITTFaxDecode-with-EncodedByteAlign-How-to-create-a-TIFF-from-that-td3755.html

//    /Width                    3504
        //    /Height                    2480
        //    /BitsPerComponent        1
        //    /ColorSpace                /DeviceGray
        //    /Length                    2 0 R
        //    /DecodeParms
        //        /K                    0
        //        /Columns            3504
        //        /Rows                2480
        //        /EncodedByteAlign    true
        //        /EndOfBlock            false

        //////////////////////////////////////////////////////////////////////////////////////////////////////         TIFF* image = TIFFOpen ( "c:\\CCITT - K = 0 - Ext.tiff", "w" );

        TIFFSetField(image, TIFFTAG_IMAGEWIDTH, 3504);
        TIFFSetField(image, TIFFTAG_IMAGELENGTH, 2480);
        TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, 1);
        TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, 1);
        TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
        TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, 2480);

        TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_CCITTRLE);

        TIFFSetField(image, TIFFTAG_FAXMODE, FAXMODE_BYTEALIGN | FAXMODE_CLASSF);

        TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MI