GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / TiffCloseMultiPageFile Method
A unique image identifier of the GdPicture image representing the image stored as the first page of the multipage TIFF image file. You need to release this image using the ReleaseGdPictureImage method after closing the image file.
Example





In This Topic
TiffCloseMultiPageFile Method (GdPictureImaging)
In This Topic
Terminates and closes a multipage TIFF image file represented by a unique image identifier of the GdPicture image, that has been previously initialized with one of the TiffSaveAsMultiPageFile() methods.
Syntax
'Declaration
 
Public Function TiffCloseMultiPageFile( _
   ByVal TiffImageID As Integer _
) As GdPictureStatus
public GdPictureStatus TiffCloseMultiPageFile( 
   int TiffImageID
)
public function TiffCloseMultiPageFile( 
    TiffImageID: Integer
): GdPictureStatus; 
public function TiffCloseMultiPageFile( 
   TiffImageID : int
) : GdPictureStatus;
public: GdPictureStatus TiffCloseMultiPageFile( 
   int TiffImageID
) 
public:
GdPictureStatus TiffCloseMultiPageFile( 
   int TiffImageID
) 

Parameters

TiffImageID
A unique image identifier of the GdPicture image representing the image stored as the first page of the multipage TIFF image file. You need to release this image using the ReleaseGdPictureImage method after closing the image file.

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
Be aware that this method is explicitly intended for use on images previously initialized by one of the TiffSaveAsMultiPageFile() methods. Please follow the attached example on how to properly use the method.

This method requires the Image Documents component to run.

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, 75 /*Jpeg quality*/);
 
    /*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