This method adds a page to the end of a multipage tiff and saves it to file.

[Visual Basic] Public Function AppendTiffImage(Val As Newtone.ImageKit.SaveFileType, SaveImage As Image) As Boolean
[C#] public bool AppendTiffImage(Newtone.ImageKit.SaveFileType Val, Image SaveImage);

Parameters

Val
     The image format of the saved image (of type Newtone.ImageKit.SaveFileType)

SaveImage
     The image to be saved

Return Value

Returns True if successful. Returns False if unsuccessful.

Explanation

The AppendTiffImage method adds a page to the end of a multipage tiff and saves it to file. The image set in the SaveImage parameter will be added as the last page in the Tiff file set in the FileName property. If no image file is set in the FileName property then the AppendTiffImage will save the image set in the SaveImage parameter as a single page Tiff image.

Then AppendTiffImage method is enabled when a Tiff image format is set in the Val parameter. It is possible for different pages in the multipage Tiff file to have different Tiff compression formats. If a file format other than a Tiff format is chosen for the Val parameter, or if the image file set in the FileName property is not a Tiff file, then the AppendTiffImage method will fail and return a value of False. The image set in the SaveImage parameter need not be a Tiff image but there are issues regarding the bitcount that must be considered. See explanation below.

When the SaveImage parameter contains a valid image:
The image set in the SaveImage parameter will be appended to and saved in the location set in the FileName property.

When the SaveImage parameter is null (Nothing in VisualBasic):
The image referred to by the ImageKit.LayerNumber property (i.e. If LayerNumber = -1, then the image set in the ImageKit.Image property or if LayerNumber = 0 thru 99, then the image set in the ImageKit.Layer(LayerNumber).Image property) will be appended to the image set in the FileName property and saved.

Regarding tiff compression and image bitcounts:
Depending on the tiff compression choosen, images with certain bitcounts may not be able to be saved. In this case, errors may result. Below is a table listing the tiff compression and the bitcounts that are possible with that compression
 

Format Compatible Bitcount
Tiff (Uncompressed) 1, 4, 8, 16 (16 grayscale not supported), 24, 32.
Tiff (Group 3-1D) 1, 4, 8, 16 (16 grayscale not supported), 24, 32.
Important: On Windows Vista, only 1 bit images are supported. All other bitcounts will fail
Tiff (Group 4) 1, 4, 8, 16 (16 grayscale not supported), 24, 32.
Important: On Windows Vista, only 1 bit images are supported. All other bitcounts will fail
Tiff (Packbits) 1, 24.
Tiff (LZW) 1, 4, 8, 16 (16 grayscale not supported), 24, 32.

Tiff Group3-1D are the same format as MH. Tiff Group4 are the same format as MMR.
In Uncompressed and LZW formats, 16 bit images are converted to 24 bit images.

Examples

The following code will load a 1 bit BMP image, convert it to a Tiff G4 image and append it to the end of a multipage Tiff file

[Visual Basic.NET]
    ImagKit1.File.FileName = "1bitBMP.bmp"
    If ImagKit1.File.LoadImageFromFile() = False Then Exit Sub

    ImagKit1.File.FileName = "MultiTiff.tif" 'The multipage tiff file where the image is appended and saved
    ImagKit1.File.AppendTiffImage(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, Nothing)

[Visual C#.NET]
    ImagKit1.File.FileName = "1bitBMP.bmp";
    if (!ImagKit1.File.LoadImageFromFile()) return;

    ImagKit1.File.FileName = "MultiTiff.tif"; //The multipage tiff file where the image is appended and saved
    ImagKit1.File.AppendTiffImage(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, null);

Also See

ImageKit.File Members | Newtone.ImageKit.Win.ImageKit

The ImageKit.NET3 is created by Newtone Corporation