Get Color Depth
using IronSoftware.Drawing;
using System;

// Load an AnyBitmap from a file
AnyBitmap sample = AnyBitmap.FromFile(@"FILE_PATH");

// Gets and prints the color depth in terms of bits per pixel
var colorDepth = sample.BitsPerPixel;
Console.WriteLine(colorDepth);
NuGet Download
PM > Install-Package IronSoftware.System.Drawing
Get Color Depth

Get Color Depth

Color depth is measured in bits per pixel (bpp), used to provide information on the color components. This is either in terms of the bits used to indicate the color of a single pixel or the number of bits used for each color component of a single pixel. It can also be used to determine the quality of an image, as different image bpp results in varying image quality (higher bpp generally indicates more image definition).

An image file can be read from a file path using AnyBitmap.FromFile("FILE_PATH"). You can then use <code>.BitsPerPixel</code> on the generated AnyBitmap object to get the color depth of the image.

View on GitHub

Ready to Get Started?

Nuget Downloads 21,321,696Version:2026.11just released