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 As Integer, _
ByVal As Stream, _
ByVal As Boolean, _
ByVal As TiffCompression, _
ByVal As Integer _
) As GdPictureStatus
public GdPictureStatus SaveAsTIFF(
int ,
Stream ,
bool ,
TiffCompression ,
int
)
public function SaveAsTIFF(
: Integer;
: Stream;
: Boolean;
: TiffCompression;
: Integer
): GdPictureStatus;
public function SaveAsTIFF(
: int,
: Stream,
: boolean,
: TiffCompression,
: int
) : GdPictureStatus;
public: GdPictureStatus SaveAsTIFF(
int ,
Stream* ,
bool ,
TiffCompression ,
int
)
public:
GdPictureStatus SaveAsTIFF(
int ,
Stream^ ,
bool ,
TiffCompression ,
int
)
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.
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);
}
}
}
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