SaveAsTIFF(Int32,String,TiffCompression) Method
In This Topic
Saves a required GdPicture image to a given file path as Tagged Image File Format (tif) acording to what you have specified.
This method only saves the currently selected page of the specified image if it is an editable multipage TIFF image.
Syntax
'Declaration
Public Overloads Function SaveAsTIFF( _
ByVal As Integer, _
ByVal As String, _
ByVal As TiffCompression _
) As GdPictureStatus
public GdPictureStatus SaveAsTIFF(
int ,
string ,
TiffCompression
)
public function SaveAsTIFF(
: Integer;
: String;
: TiffCompression
): GdPictureStatus;
public function SaveAsTIFF(
: int,
: String,
: TiffCompression
) : GdPictureStatus;
public: GdPictureStatus SaveAsTIFF(
int ,
string* ,
TiffCompression
)
public:
GdPictureStatus SaveAsTIFF(
int ,
String^ ,
TiffCompression
)
Parameters
- ImageID
- A unique image identifier of the GdPicture image representing the image to be saved.
- FilePath
- The file path where the specified image will be saved. Use the empty string to allow the control to prompt users to select a file. If the specified file already exists, it will be overwritten.
You can subsequently use the GdPictureImaging.GetLastPath method to retrieve the path of the selected file.
- 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.SaveAsTIFF 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 a tiff image.
Removing lines from a black and white tiff image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", true);
// Remove vertical and horizontal lines using default parameters.
gdpictureImaging.RemoveLines(imageID, LineRemoveOrientation.Horizontal | LineRemoveOrientation.Vertical);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Inverting white text with black background to become black text with white background within a tiff image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", true);
// Invert white text with black background.
gdpictureImaging.AutoTextInvert(imageID, 100, 100, 60, 100, true, false, 1);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Saving a tiff image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", true);
// Remove vertical and horizontal lines using default parameters.
gdpictureImaging.RemoveLines(imageID, LineRemoveOrientation.Horizontal | LineRemoveOrientation.Vertical);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.tif", true);
// Invert white text with black background.
gdpictureImaging.AutoTextInvert(imageID, 100, 100, 60, 100, true, false, 1);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also