This method inserts a page into a multipage tiff.
Parameters
Val
The image format of the saved image
(of type Newtone.ImageKit.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.
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
Dim ik_file As Newtone.ImageKit.IfFile = New Newtone.ImageKit.WPF.IkFile()
ik_file.FileName = "1bitBMP.bmp"
If ik_file.LoadImageFromFile() = False Then Exit Sub
ik_file.FileName = "MultiTiff.tif" 'The multipage tiff file where the image is inserted and saved
ik_file.InsertPageIntoMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, PictureBox1.Image, 3) ik_file.Dispose()
[Visual C#.NET]
Newtone.ImageKit.WPF.IkFile ik_file = New Newtone.ImageKit.WPF.IkFile();
ik_file.FileName = "1bitBMP.bmp";
if (!ik_file.LoadImageFromFile()) return;
ik_file.FileName = "MultiTiff.tif"; //The multipage tiff file where the image is inserted and saved
ik_file.InsertPageIntoMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, pictureBox1.Image, 3); ik_file.Dispose();