GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureImaging Class / GetBitDepth Method
GdPicture image identifier.
Example





In This Topic
GetBitDepth Method (GdPictureImaging)
In This Topic
Returns the bit depth (Bits per Pixel) of a GdPicture image.
Syntax
'Declaration
 
Public Function GetBitDepth( _
   ByVal ImageID As Integer _
) As Integer
public int GetBitDepth( 
   int ImageID
)
public function GetBitDepth( 
    ImageID: Integer
): Integer; 
public function GetBitDepth( 
   ImageID : int
) : int;
public: int GetBitDepth( 
   int ImageID
) 
public:
int GetBitDepth( 
   int ImageID
) 

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);
}
See Also