GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / SaveAsTIFF Method / SaveAsTIFF(Int32,Stream,Boolean,TiffCompression,Int32) Method
GdPicture image identifier.
A stream object to save the image file.
Set True to save tiff in CMYK color space, else False.
A member of the TiffCompression enumeration.
Specifies the compression quality, between 1 (worst quality) and 100 (better quality). This parameter is ignored when the specified compression scheme is different than JPEG.
Example





In This Topic
SaveAsTIFF(Int32,Stream,Boolean,TiffCompression,Int32) Method
In This Topic
Saves a GdPicture image as Tagged Image File Format. This methods takes a parameter to save tiff in CMYK color space and another parameter to defines jpeg quality .
Syntax
'Declaration
 
Public Overloads Function SaveAsTIFF( _
   ByVal ImageID As Integer, _
   ByVal Stream As Stream, _
   ByVal CMYKMode As Boolean, _
   ByVal Compression As TiffCompression, _
   ByVal JpegQuality As Integer _
) As GdPictureStatus
public GdPictureStatus SaveAsTIFF( 
   int ImageID,
   Stream Stream,
   bool CMYKMode,
   TiffCompression Compression,
   int JpegQuality
)
public function SaveAsTIFF( 
    ImageID: Integer;
    Stream: Stream;
    CMYKMode: Boolean;
    Compression: TiffCompression;
    JpegQuality: Integer
): GdPictureStatus; 
public function SaveAsTIFF( 
   ImageID : int,
   Stream : Stream,
   CMYKMode : boolean,
   Compression : TiffCompression,
   JpegQuality : int
) : GdPictureStatus;
public: GdPictureStatus SaveAsTIFF( 
   int ImageID,
   Stream* Stream,
   bool CMYKMode,
   TiffCompression Compression,
   int JpegQuality
) 
public:
GdPictureStatus SaveAsTIFF( 
   int ImageID,
   Stream^ Stream,
   bool CMYKMode,
   TiffCompression Compression,
   int JpegQuality
) 

Parameters

ImageID
GdPicture image identifier.
Stream
A stream object to save the image file.
CMYKMode
Set True to save tiff in CMYK color space, else False.
Compression
A member of the TiffCompression enumeration.
JpegQuality
Specifies the compression quality, between 1 (worst quality) and 100 (better quality). This parameter is ignored when the specified compression scheme is different than JPEG.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
If the specified GdPicture image is an editable multipage tiff image, this method will save only the selected page.

This method requires the Image Documents component to run.

Example
Applying ICM correction when saving CMYK based image as a tiff image using streams.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    string filePath = "image.jpg";
    if (gdpictureImaging.IsCMYKFile(filePath))
    {
        // Enable color correction.
        gdpictureImaging.EnableICM(true);
 
        using (System.IO.Stream inputStream = new System.IO.FileStream(filePath, System.IO.FileMode.Open))
        {
            int imageID = gdpictureImaging.CreateGdPictureImageFromStream(inputStream, filePath);
            using (System.IO.Stream outputStream = new System.IO.FileStream("output.tiff", System.IO.FileMode.CreateNew))
            {
                gdpictureImaging.SaveAsTIFF(imageID, outputStream, true, TiffCompression.TiffCompressionJPEG, 90);
            }
            // Release used resources.
            gdpictureImaging.ReleaseGdPictureImage(imageID);
        }
    }
}
See Also