There are many ways to create or delete images from a multipage TIFF file.
In order to create a multipage TIFF file you can do one of the following:
Save a DIB to a file which already exists and the DIB will be appended to the image
Use the InsertTiffImage function (or method) from BiTiff.dll (BiTiff.ocx)
Use MergeTiffFiles function (or method) from BiTiff.dll (BiTiff.ocx)
To delete an image from a multipage TIFF file:
Use DeleteTiffImage function (method) from BiTiff.dll (BiTiff.ocx)
Use SplitTiffFile function (method) from BiTiff.dll (BiTiff.ocx)
[C++]
/* Insert a DIB into a TIFF file*/
#include “BiTiff.h”
BOOL bRet;
/* 1. parameter: Path and name of the TIFF file
2. parameter: Handle of the DIB to insert
3. parameter: Compression type
4. parameter: Display dialog box
5. parameter: Fill order (1 – normal 2 – reverse)
6. parameter: Position to insert or change image at
7. parameter: Fast or Slow saving method
8. parameter: Overwrite or insert the image */
bRet = InsertTiffImage(“C:\\Images\\Test.tif”, hDib,
TCOM_NOCOMP, TRUE, NORM_BIT_ORDER,
3, FALSE, FALSE);
if (!bRet)
{
// Error
}
[VB]
‘ Insert a DIB into a TIFF file
Dim BITiffobj As Object
Dim bRet As Boolean
Private Const NORM_BIT_ORDER = 1
Private Const REV_BIT_ORDER = 2
Set BITiffobj = CreateObject("BITIFF.BITiffCtrl.1")
‘ 1. parameter: Path and name of the TIFF file
‘ 2. parameter: Handle of the DIB to insert
‘ 3. parameter: Compression type
‘ 4. parameter: Display dialog box
‘ 5. parameter: Fill order (1 – normal 2 – reverse)
‘ 6. parameter: Position to insert or change image at
‘ 7. parameter: Fast or Slow saving method
‘ 8. parameter: Overwrite or insert the image */
bRet = BITiffobj.InsertTiffImage(“C:\Images\Test.tif”, hDib, TCOMP_NOCOMP, True, NORM_BIT_ORDER, 3, False, False)
Set BITiffobj = Nothing
If Not bRet Then
‘ Error
End If
[C#]
/* Insert a DIB into a TIFF file*/
bool bRet;
/* 1. parameter: Path and name of the TIFF file
2. parameter: Handle of the DIB to insert
3. parameter: Compression type
4. parameter: Display dialog box
5. parameter: Fill order (1 – normal 2 – reverse)
6. parameter: Position to insert or change image at
7. parameter: Fast or Slow saving method
8. parameter: Overwrite or insert the image */
bRet = BiTiff.InsertTiffImage(“C:\\Images\\Test.tif”, hDib,
BITIFFLib.enumCompressionTypes.TCOMP_NOCOMP, true, BITIFFLib.enumFillOrder.tiffoNormal,
3, false, false);
if (!bRet)
{
// Error
}