GdPicture.NET Reference Guide
HistogramGet8Bpp Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : HistogramGet8Bpp Method
GdPicture Image Identifier.
Output parameter. Array of 256 entries containing the histogram data.
Computes the colors histogram of a 8bpp indexed GdPicture image.
Syntax
'Declaration
 
Public Function HistogramGet8Bpp( _
   ByVal ImageID As Integer, _
   ByRef Data As Integer() _
) As GdPictureStatus
public GdPictureStatus HistogramGet8Bpp( 
   int ImageID,
   ref int[] Data
)
public function HistogramGet8Bpp( 
    ImageID: Integer;
   var  Data: array of Integer
): GdPictureStatus; 
public function HistogramGet8Bpp( 
   ImageID : int,
   Data : int[]
) : GdPictureStatus;
public: GdPictureStatus HistogramGet8Bpp( 
   int ImageID,
   ref int[] Data
) 
public:
GdPictureStatus HistogramGet8Bpp( 
   int ImageID,
   array<int>% Data
) 

Parameters

ImageID
GdPicture Image Identifier.
Data
Output parameter. Array of 256 entries containing the histogram data.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
This method works only with 8bpp image.
Example
Finding out the most frequent color value in an image.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("input.png")
If imageId <> 0 Then
   If oGdPictureImaging.GetBitDepth(ImageID) <> 8 Then
      oGdPictureImaging.ConvertTo8BppGrayScale(ImageID)
   End If
   Dim arHisto(0 to 255) As Integer
   oGdPictureImaging.HistogramGet8Bpp(ImageID, arHisto)
   Dim Max As Integer = -1
   For i As Integer = 0 To 255
      If Max < arHisto(i) Then
         Max = arHisto(i)
      End If
   Next
   MessageBox.Show("The most frequent value in the image is: " + Max.ToString())
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
Else
   MessageBox.Show("Error: " + oGdPictureImaging.GetStat().ToString())
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members