Cut a Multipage TIFF File

Q:  How can I cut a large multipage TIFF file into single page TIFF files?

A:  If you have a multipage TIFF file you can easily cut into single page files. The TIFF file should be maximum 24 bit per pixel image. The BITIFF.DLL contains a CutTiffFile function that solves this problem. So you can decrease the size of the image. See the description of the function.

 

Code example:

       #include “BiTiff.h”

       …

       char szSourceFile[MAX_PATH], szNewFile[MAX_PATH];

       int     iPage;

       BOOL bOK;

       strcpy(szNewFile, “c:\\cutImg.tif”);

       iPage = 2;

       //split the file

       BeginWaitCursor();

       bOK = CutTiffFile(szSourceFile, szNewFile, iPage, NULL, NULL); (szSourceFile, szNewFile,

       iPage, NULL, NULL);

       EndWaitCursor();

       if (bOK)

       {

                pDoc->OnOpenDocument(pDoc->szTiffFileName);

       }

       else

                AfxMessageBox("There was an error during the split.", _OK|MB_ICONERROR, NULL);