GdPicture.NET Reference Guide
GetBitDepth Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : GetBitDepth Method
GdPicture Image Identifier.
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 noise from a bitonal image, and checking that it is a 1 bit per pixel image with black and white palette.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.tif")
If imageId <> 0 Then
   If oGdPictureImaging.GetBitDepth(ImageID) <> 1 Then
      oGdPictureImaging.ConvertTo1BppAT(ImageID)
   End If
   oGdPictureImaging.FxBitonalDespeckle(ImageID, False)
   oGdPictureImaging.SaveAsTIFF(ImageID, "test.tif", TiffCompression.TiffCompressionCCITT4)
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members