This method inserts a page into a multipage tiff.

[Visual Basic] Public Function InsertPageIntoMultipageTiff(Val As Newtone.ImageKit.WPF.SaveFileType, SaveImage As Image, insertPage As Integer) As Boolean
[C#] public bool InsertPageIntoMultipageTiff(Newtone.ImageKit.WPF.SaveFileType Val, Image SaveImage, int insertPage);

Parameters

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

SaveImage
     The image to be saved

insertPage
     The location where the page is inserted

Return Value

Returns True if successful. Returns False if unsuccessful.

Explanation

The InsertPageIntoMultipageTiff method inserts a page into a multipage tiff. The image set in the SaveImage parameter will be inserted into the Tiff file set in the FileName property at the page location set in the insertPage parameter. This method is enabled when the insertPage parameter is set to 1 or more. If the value of the insertPage parameter is greater than the number of pages in the multipage Tiff, then image set in the SaveImage parameter will be added to the end of the multipage Tiff file. The new multipage tiff file will be saved in the location specified by the FileName property.

If no image file is set in the FileName property then the InsertPageIntoMultipageTiff will return False.

The InsertPageIntoMultipageTiff 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, if the insertPage parameter is set to 0 or less, or if the image file set in the FileName property is not a Tiff file, then the InsertPageIntoMultipageTiff 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 inserted into the image 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 inserted into 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 insert it into 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 inserted and saved
    ImagKit1.File.InsertPageIntoMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, Nothing, 3)

[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 inserted and saved
    ImagKit1.File.InsertPageIntoMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, null, 3);

Also See

ImageKit.File Members | Newtone.ImageKit.Wpf.ImageKit

The ImageKit WPF is created by Newtone Corporation