TiffSaveMultiPageToFile(Int32,String,TiffCompression,Int32) Method
Saves a GdPicture image representing the editable multipage TIFF image to a multipage TIFF file acording to what you have specified. You can also define a JPEG quality parameter when the JPEG compression is required using this method.
This method only handles editable multipage TIFF images; otherwise it will fail.
'Declaration
Public Overloads Function TiffSaveMultiPageToFile( _
ByVal As Integer, _
ByVal As String, _
ByVal As TiffCompression, _
ByVal As Integer _
) As GdPictureStatus
Parameters
- ImageID
- A unique image identifier of the GdPicture image representing the editable multipage TIFF image to be saved.
- FilePath
- The file path where the specified image will be saved. Be aware, that if the destination file path is the same as the source file path,
the method will fail unless the image has not been loaded in memory.
- Compression
- A member of the TiffCompression enumeration. The resulting TIFF compression scheme to be used.
- JpegQuality
- The compression quality level from 0 to 100. 0 means the worst quality and the best compression, 100 means the best quality and the worst compression.
This parameter is ignored when the required compression scheme is different than JPEG.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Saving pages to a multipage tiff.
Swapping two pages in a multipage tiff document.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.TiffCreateMultiPageFromFile("multipage.tif", true);
gdpictureImaging.TiffSwapPages(imageID, 1, 2);
gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionJPEG, 90);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Saving the pages of a dicom document to a multipage tiff.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int dcmImageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
// Create a tiff with the first page.
int tiffImageID = gdpictureImaging.TiffCreateMultiPageFromGdPictureImage(dcmImageID);
// Add the remaining pages as additional pages to the tif.
int pageCount = gdpictureImaging.DicomGetPageCount(dcmImageID);
for (int pageNo = 2; pageNo <= pageCount; pageNo++)
{
gdpictureImaging.DicomSelectPage(dcmImageID, pageNo);
gdpictureImaging.TiffAppendPageFromGdPictureImage(tiffImageID, dcmImageID);
}
gdpictureImaging.TiffSaveMultiPageToFile(tiffImageID, "image.tif", TiffCompression.TiffCompressionJPEG, 90);
gdpictureImaging.TiffCloseMultiPageFile(tiffImageID);
gdpictureImaging.ReleaseGdPictureImage(tiffImageID);
gdpictureImaging.ReleaseGdPictureImage(dcmImageID);
}