This method modifies a specified page of an existing multipage tiff file.
Parameters
Val
The image format of the image used to
modify the page (of type Newtone.ImageKit.SaveFileType)
SaveImage
The image used to modify the page
modifyPage
The page that is modified
Return Value
Returns True if successful. Returns False if unsuccessful.
Explanation
The ModifyPageInMultipageTiff method modifies a specified page of an existing multipage tiff file. The image set in the SaveImage parameter will be used to modify the page, specified by the modifyPage parameter, of an existing Tiff file set in the FileName property. This method is enabled when the modifyPage parameter is set to 1 or more. This method is only enabled when the image set into the Val parameter is a Tiff image. The compression format of each page of the multipage tiff file to be created and the compression format set in the argument Val are valid even if different compression formats are mixed. If the value of the modifyPage parameter is greater than the number of pages in the multipage Tiff, if the value of the modifyPage parameter is 0 or less, if the file set in the FileName property doesn't exist or is not a tiff file, then the ModifyPageInMultipageTiff method will fail and False will be returned.
If a valid image is set in SaveImage parameter, then that image will replace the image in the existing page specified in the modifyPage parameter.
Regarding tiff compression and image bitcounts:
Each compression format has its own number of bits that can be
saved. Please note that an error will occur if you try to save a
bit number that is outside the range of bits allowed. The following
table shows the number of bits that can be saved.
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
Example #1:
The following code will convert the image loaded into the
PictureBox control to a Tiff image in G4 format, change it to the
image on page 3 of the multipage tiff file currently loaded into
the ImageKit control, and save it.
Dim ik_file As Newtone.ImageKit.IkFile = New Newtone.ImageKit.IkFile()
ik_file.FileName = "MultiTiff.tif" 'The saved tiff file
ik_file.ModifyPageInMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, PictureBox1.Image, 3)
[Visual C#.NET]
Newtone.ImageKit.IkFile ik_file = new Newtone.ImageKit.IkFile();
ik_file.FileName = "MultiTiff.tif"; //The saved tiff file
ik_file.ModifyPageInMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, pictureBox1.Image, 3);
Example #2:
Convert the BMP file loaded by the IkFile class to a Tiff image in
G4 format, change it to the image of the third page of an existing
multi Tiff file, and save it.
Dim ik_file As Newtone.ImageKit.IkFile = New Newtone.ImageKit.IkFile()
ik_file.FileName = "1bitBMP.bmp"
Dim mdfy_img As Image = ik_file.LoadImageFromFile();
If mdfy_img = Nothing Then Exit Sub
ik_file.FileName = "MultiTiff.tif" 'The saved tiff file
ik_file.ModifyPageInMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, mdfy_img, 3)
[Visual C#.NET]
Newtone.ImageKit.IkFile ik_file = new Newtone.ImageKit.IkFile();
ik_file.FileName = "1bitBMP.bmp";
Image mdfy_img = ik_file.LoadImageFromFile();
if (mdfy_img == null) return;
ik_file.FileName = "MultiTiff.tif"; //The saved tiff file
ik_file.ModifyPageInMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, mdfy_img, 3);