IRONSOFTWAREHOME
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);
Imports IronSoftware.Drawing
Imports System

' Load an AnyBitmap from a file
Dim sample As AnyBitmap = AnyBitmap.FromFile("FILE_PATH")

' Gets and prints the color depth in terms of bits per pixel
Dim 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 20,274,271Version:2026.11just released

Key in blue circle

Get your free 30-day Trial Key instantly

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronDrawing
Get a Quote, No Obligation
Your details will always be kept confidential.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Trusted by Millions of Engineers Worldwide
Get your free 30-day Trial Key instantly.
No credit card or account creation required