GetBitDepth Method (GdPictureImaging)
In This Topic
Returns the bit depth (Bits per Pixel) of a GdPicture image.
Syntax
'Declaration
Public Function GetBitDepth( _
ByVal As Integer _
) As Integer
public int GetBitDepth(
int
)
public function GetBitDepth(
: Integer
): Integer;
public function GetBitDepth(
: int
) : int;
public: int GetBitDepth(
int
)
public:
int GetBitDepth(
int
)
Parameters
- ImageID
- GdPicture image identifier.
Return Value
Can be:
1. For 1 bit per pixel image.
4. For 4 bits per pixel image.
8. For 8 bits per pixel image.
16. For 16 bits per pixel image.
24. For 24 bits per pixel image.
32. For 32 bits per pixel image.
48. For 48 bits per pixel image.
64. For 64 bits per pixel image.
Example
Removing staple marks on 1bpp b&w image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp");
if ((gdpictureImaging.GetBitDepth(imageID) == 1) && gdpictureImaging.IsBitonal(imageID, 0))
{
gdpictureImaging.RemoveStapleMark(imageID);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
}
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Removing staple marks on 1bpp b&w image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp");
if ((gdpictureImaging.GetBitDepth(imageID) == 1) && gdpictureImaging.IsBitonal(imageID, 0))
{
gdpictureImaging.RemoveStapleMark(imageID);
gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
}
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also