TiffSaveMultiPageToFile(Int32,String,TiffCompression) Method
In This Topic
Saves a GdPicture image representing the editable multipage TIFF image to a multipage TIFF file acording to what you have specified.
This method only handles editable multipage TIFF images; otherwise it will fail.
Syntax
'Declaration
Public Overloads Function TiffSaveMultiPageToFile( _
ByVal As Integer, _
ByVal As String, _
ByVal As TiffCompression _
) As GdPictureStatus
public GdPictureStatus TiffSaveMultiPageToFile(
int ,
string ,
TiffCompression
)
public function TiffSaveMultiPageToFile(
: Integer;
: String;
: TiffCompression
): GdPictureStatus;
public function TiffSaveMultiPageToFile(
: int,
: String,
: TiffCompression
) : GdPictureStatus;
public: GdPictureStatus TiffSaveMultiPageToFile(
int ,
string* ,
TiffCompression
)
public:
GdPictureStatus TiffSaveMultiPageToFile(
int ,
String^ ,
TiffCompression
)
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.
Please note that if you apply the JPEG compression, the quality factor used by default is 90. You can use the overloaded TiffSaveMultiPageToFile(Int32,String,TiffCompression,Int32) method to set your preferred value for the JpegQuality parameter.
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.
Example
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.TiffCompressionAUTO);
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.TiffCompressionAUTO);
gdpictureImaging.TiffCloseMultiPageFile(tiffImageID);
gdpictureImaging.ReleaseGdPictureImage(tiffImageID);
gdpictureImaging.ReleaseGdPictureImage(dcmImageID);
}
Example
Saving pages to a multipage tiff.
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.TiffCompressionAUTO);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
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.TiffCompressionAUTO);
gdpictureImaging.TiffCloseMultiPageFile(tiffImageID);
gdpictureImaging.ReleaseGdPictureImage(tiffImageID);
gdpictureImaging.ReleaseGdPictureImage(dcmImageID);
}
See Also