- About Graphics Mill
- What's New?
- Breaking Changes in Graphics Mill 12
- Breaking Changes in Graphics Mill 11
- Features
- Supported File Formats
- System Requirements
- Getting Started
- Working with Image Formats
- Transforming Images (Resize, Rotate, Crop)
- Working with Metadata
- Color Management and Color Reduction
- Drawing Text and Graphics
- Color Keying (Green Screen Removal)
- Channels and Pixel Data
- Color and Tone Correction
- Working with Photoshop (PSD) Files
- Image Filters
- Processing Large Images
- Basics of Image Processing
- Troubleshooting
- Class Library Reference
- Aurigma.GraphicsMill Namespace
- AmbiguousFontCollisionException Class
- Bitmap Class
- BitmapEmptyException Class
- BitmapStatisticsProvider Class
- Channel Enumeration
- ChannelCombiner Class
- ChannelSplitter Class
- ChannelsProvider Class
- CMAdobeModuleLoadException Class
- CMException Class
- CMInappropriateProfileException Class
- CMOpenProfileException Class
- CMTransformException Class
- Cmyk16Color Class
- CmykChannelCombiner Class
- CmykChannelSplitter Class
- CmykColor Class
- CodecAdapter Class
- Color Class
- ColorAdjustmentProvider Class
- ColorManagementProvider Class
- ColorPalette Class
- ColorPaletteEmptyException Class
- ColorPaletteType Enumeration
- ColorProfile Class
- ColorProfileClass Enumeration
- ColorSpace Enumeration
- CompressedImage Class
- CompressedStream Class
- Configuration Class
- DuplicateFamilyStyleException Class
- DuplicateFontAliasException Class
- DuplicatePostscriptNameException Class
- FamilyStyleConflict Class
- FontException Class
- FontMissingException Class
- GMException Class
- GraphicsContainerRasterizer Class
- Grayscale16Color Class
- GrayscaleChannelCombiner Class
- GrayscaleChannelSplitter Class
- GrayscaleColor Class
- Histogram Class
- HistogramMode Enumeration
- IImageDescriptor Interface
- IImageParams Interface
- Image Class
- ImageGenerator Class
- ImageParams Class
- IndexedColor Class
- Ink Class
- InvalidPropertyValueException Class
- InvalidSourceException Class
- Lab16Color Class
- LabChannelCombiner Class
- LabChannelSplitter Class
- LabColor Class
- MissingIndexColorException Class
- ObjectClosedException Class
- ObjectEmptyException Class
- OnInitEventArgs Class
- OutOfMemoryException Class
- Pipeline Class
- PipelineElement Class
- PipelineException Class
- PixelFormat Class
- PostscriptNameConflict Class
- ProgressEventArgs Class
- ProgressReporter Class
- Rational Class
- Rgb16Color Class
- RgbChannelCombiner Class
- RgbChannelSplitter Class
- RgbColor Class
- SehException Class
- SpotColor Class
- TransformException Class
- TransformsProvider Class
- TrialPeriodTimeException Class
- UnexpectedException Class
- Unit Enumeration
- UnitConverter Class
- UnsignedRational Class
- UnsupportedFontException Class
- UnsupportedPixelFormatException Class
- Win32Exception Class
- Aurigma.GraphicsMill.Codecs Namespace
- Aurigma.GraphicsMill.Codecs.ClippingPath Namespace
- Aurigma.GraphicsMill.Codecs.Psd Namespace
- Aurigma.GraphicsMill.Drawing Namespace
- Aurigma.GraphicsMill.Drawing.Art Namespace
- Aurigma.GraphicsMill.Drawing.Effects Namespace
- Aurigma.GraphicsMill.Licensing Namespace
- Aurigma.GraphicsMill.Templates Namespace
- Aurigma.GraphicsMill.Transforms Namespace
- Aurigma.GraphicsMill Namespace
- Licensing
- End User License Agreement
- Copyright Notices
Histogram Class
Applies to: Graphics Mill 12.1, 6.x-12.x (may differ)
Represents a bitmap histogram.
Namespace:
Aurigma.GraphicsMill
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Syntax
public sealed class Histogram : IDisposable
Remarks
Histograms are widely used in imaging. It is represented as an array which contains values specifying as much items as intensity levels are supported by a bitmap (i.e. for 8 bit per channel bitmaps it will be 256, for 16 bit per channel - 65356). Each histogram entry stores a number of bitmap pixels which have the same intensity level as index of this entry. For example, the first histogram entry contains a number of black pixels (i.e. pixels having zero intensity level). Entry at index 192 contains a number of pixels with intensity level equal to 192.
When Graphics Mill builds a histogram for a grayscale bitmap, it uses pixel value as an intensity level. For color bitmaps (RGB, CMYK) several algorithms for calculating intensity level of each pixel are available. Graphics Mill implements two of them:
- Luminosity Pixel color is converted to grayscale and this value is used as intensity level. This conversion is made by adding all channel values multiplied at weights (all weights are normalized at 1). These weights are selected with taking into consideration specifics of human vision, that's why it provides more precise result comparing to the Sum method. You can build luminosity histogram using BuildLuminosity(Bitmap) method.
- Sum Graphics Mill calculates sum of all channels of the pixel and divides it by the count of channels. The advantage of this method is a possibility to exclude some channel from the intensity level calculation. This way you can get a histogram, e.g., for one or two channels. This method is implemented at Adobe® Photoshop®. To build sum histogram, use some of overload of BuildSum() method.
Histogram enables you to estimate image contrast programmatically. Also you can get some other characteristics (mean brightness, standard deviation, median, etc).
Histogram is used (explicitly or implicitly) in a number of Graphics Mill transforms, such as HistogramEqualize, Levels, BrightnessContrast (in automatic mode), etc.
Examples
var histogram = bitmap.Statistics.GetSumHistogram();
for (int i = 0; i < histogram.Length; i++)
{
Console.WriteLine(i + ": " + histogram[i]);
}