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.
If the SaveImage parameter is null (Nothing for VisualBasic):
the LayerNumber property
value will be used to specify whether the image set in the ImageKit.Image property or the layer
images specified by the ImageKit.Layer(LayerNumber).Image
property is used to replace the image in the existing page
specified by the modifyPage parameter.
* LayerNumber = -1 sets the image in the ImageKit.Image property. LayerNumber =
0~99 sets the image in the ImageKit.Layer(LayerNumber).Image
property.
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.
ImagKit1.File.FileName = "MultiTiff.tif" 'The saved tiff file
ImagKit1.File.ModifyPageInMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, PictureBox1.Image, 3)
[Visual C#.NET]
ImagKit1.File.FileName = "MultiTiff.tif"; //The saved tiff file
ImagKit1.File.ModifyPageInMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, pictureBox1.Image, 3);
Example #2:
Convert the BMP file loaded into the ImageKit control to a Tiff
image in G4 format, change it to the image of page 3 of the
existing multi Tiff file, and save it.
ImagKit1.File.FileName = "1bitBMP.bmp"
If ImagKit1.File.LoadImageFromFile() = False Then Exit Sub
ImagKit1.File.FileName = "MultiTiff.tif" 'The saved tiff file
ImagKit1.File.ModifyPageInMultipageTiff(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 saved tiff file
ImagKit1.File.ModifyPageInMultipageTiff(Newtone.ImageKit.SaveFileType.SaveTIFFGroup4, null, 3);