GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / TiffSaveAsMultiPageFile Method / TiffSaveAsMultiPageFile(Int32,String,TiffCompression) Method
A unique image identifier of the GdPicture image representing the first page of the resulting multipage TIFF image file. Do not release this image resource before closing the resulting multipage TIFF image file using the GdPictureImaging.TiffCloseMultiPageFile method.

Please follow the attached example on how to properly use the method.

The file path where the resulting multipage TIFF image file will be saved.
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 GdPictureImaging.TiffSaveAsMultiPageFile method to set your preferred value for the JpegQuality parameter.

Example





In This Topic
TiffSaveAsMultiPageFile(Int32,String,TiffCompression) Method
In This Topic
Stores a specified GdPicture image, that is represented by its unique image identifier, as the first page of a new multipage TIFF image file to a given file path. You can subsequently add a new page to this image file using one of the TiffAddToMultiPageFile() methods, for example the GdPictureImaging.TiffAddToMultiPageFile method.

This sequential writing is the faster way to create multipage TIFF image files by adding individual pages based on one page files.

Syntax
'Declaration
 
Public Overloads Function TiffSaveAsMultiPageFile( _
   ByVal ImageID As Integer, _
   ByVal FilePath As String, _
   ByVal Compression As TiffCompression _
) As GdPictureStatus
public GdPictureStatus TiffSaveAsMultiPageFile( 
   int ImageID,
   string FilePath,
   TiffCompression Compression
)
public function TiffSaveAsMultiPageFile( 
    ImageID: Integer;
    FilePath: String;
    Compression: TiffCompression
): GdPictureStatus; 
public function TiffSaveAsMultiPageFile( 
   ImageID : int,
   FilePath : String,
   Compression : TiffCompression
) : GdPictureStatus;
public: GdPictureStatus TiffSaveAsMultiPageFile( 
   int ImageID,
   string* FilePath,
   TiffCompression Compression
) 
public:
GdPictureStatus TiffSaveAsMultiPageFile( 
   int ImageID,
   String^ FilePath,
   TiffCompression Compression
) 

Parameters

ImageID
A unique image identifier of the GdPicture image representing the first page of the resulting multipage TIFF image file. Do not release this image resource before closing the resulting multipage TIFF image file using the GdPictureImaging.TiffCloseMultiPageFile method.

Please follow the attached example on how to properly use the method.

FilePath
The file path where the resulting multipage TIFF image file will be saved.
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 GdPictureImaging.TiffSaveAsMultiPageFile 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.
Remarks
Please note that you need to close the resulting file using the GdPictureImaging.TiffCloseMultiPageFile method when you finish adding pages.

Be aware that for accessing the data of the newly created image file you have to save, close and release the image resource, and then you need to reload it again, for example, using the GdPictureImaging.CreateGdPictureImageFromFile.

Example
Generating a multipage tiff from different image files.
Generating a multipage tiff, from different image files, using specific compression mode per page.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    /*Adding first page from a jpeg file*/
    int tiffImageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
 
    // After calling TiffSaveAsMultiPageFile, tiffID will specify the multipage tiff identifier.
    gdpictureImaging.TiffSaveAsMultiPageFile(tiffImageID, "multipage.tif", TiffCompression.TiffCompressionJPEG);
 
    /*Adding second page from a png file*/
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.png");
    // Enabling horizontal differencing predictor mode for lzw compression.
    gdpictureImaging.TagSetValueString(imageID, Tags.TagPredictor, TagType.TagTypeShort, "2");
    gdpictureImaging.TiffAddToMultiPageFile(tiffImageID, imageID, TiffCompression.TiffCompressionLZW);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
 
    /*Adding third page from a single page tiff-ccitt4 file*/
    imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif");
    gdpictureImaging.TiffAddToMultiPageFile(tiffImageID, imageID, TiffCompression.TiffCompressionCCITT4);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
 
    /*Closing the produced multipage file*/
    gdpictureImaging.TiffCloseMultiPageFile(tiffImageID);
}
Applying the fire effect and negative effect to two duplicates of the same image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Create two duplicate gdpicture images from the input file.
    int imageID1 = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg", false);
    int imageID2 = gdpictureImaging.CreateClonedGdPictureImage(imageID1);
 
    // Process both of your images (differently).
    gdpictureImaging.FxFire(imageID1);
    gdpictureImaging.FxNegative(imageID2);
 
    // Save your images in the same multipage tif file.
    gdpictureImaging.TiffSaveAsMultiPageFile(imageID1, "images.tif", TiffCompression.TiffCompressionAUTO);
    gdpictureImaging.TiffAddToMultiPageFile(imageID1, imageID2);
    gdpictureImaging.TiffCloseMultiPageFile(imageID1);
    gdpictureImaging.ReleaseGdPictureImage(imageID1);
    gdpictureImaging.ReleaseGdPictureImage(imageID2);
}
See Also