Loading...

Compressing to CCIT4

Support for GdTwain ActiveX and GdTwain Pro ActiveX/SDK.

Compressing to CCIT4

Postby drose » Mon Aug 11, 2008 8:17 pm

I am evaluating this software and so far everything has gone well. However, I do not seem to be able to get my multipage tif file to compress into CCITT4 format. Instead, the image always is compressed in LZW format.

Here is my code:

Code: Select all
if (axTwain1.TwainOpenDefaultSource())
            {
                nImageCount = 0;
               
                axTwain1.TwainSetHideUI(true);
                axTwain1.TwainSetAutoFeed(true);
                axTwain1.TwainSetAutoScan(true);
                axTwain1.TwainSetCurrentImageFileFormat(GdTwainPro2.TwainImageFileFormats.TWFF_TIFFMULTI);
                axTwain1.TwainSetCurrentResolution(300);
                axTwain1.TwainSetCurrentPixelType(GdTwainPro2.TwainPixelType.TWPT_BW);
                axTwain1.TwainSetCurrentBitDepth(1);
                axTwain1.ConvertTo1Bpp();
                axTwain1.TwainSetCurrentCompression(GdTwainPro2.TwainCompression.TWCP_GROUP4);

                while (axTwain1.TwainAcquireToGdPictureImage() != 0)
                {
                    nImageID = axTwain1.GetNativeImage();
                    nImageCount = nImageCount + 1;
                    axGdViewer1.DisplayFromGdPictureImage(nImageID);
                    axGdViewer1.SetZoomFitControl();

                    if (nImageCount == 1)
                    {
                        axTwain1.TiffSaveAsNativeMultiPage("C:\\multitiff.tif");
                    }
                    else
                    {
                        axTwain1.TiffAddToNativeMultiPage(nImageID);
                        axTwain1.CloseImage(nImageID);
                    }
                }

                axTwain1.TiffCloseNativeMultiPage();
                axTwain1.TwainCloseSource();


What am I doing wrong?
drose
 
Posts: 15
Joined: Mon Aug 11, 2008 8:05 pm

Re: Compressing to CCIT4

Postby drose » Mon Aug 11, 2008 8:58 pm

Additionally, I am unable to get it to compress using any other method as well.
drose
 
Posts: 15
Joined: Mon Aug 11, 2008 8:05 pm

Re: Compressing to CCIT4

Postby Loïc » Wed Aug 13, 2008 4:24 pm

Hi,

You are using the bad syntax.

The TwainSetCurrentImageFileFormat() method should be used only if you are using the file transfer mode.

In your case, you just need to specify the optional compressio parameter of the TiffSaveAsNativeMultiPage() method.

IE:

Code: Select all
axTwain1.TiffSaveAsNativeMultiPage("C:\\multitiff.tif", CompressionCCITT4);


See: http://guides.gdpicture.com/v5/gdtwainp ... iPage.html

Best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Compressing to CCIT4

Postby drose » Thu Aug 14, 2008 4:10 pm

That did it. Thanks!
drose
 
Posts: 15
Joined: Mon Aug 11, 2008 8:05 pm


Return to GdTwain [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest