获取颜色深度
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
获取颜色深度

获取颜色深度

颜色深度以每像素比特数 (bpp) 来衡量,用于提供有关颜色分量的信息。 这要么是指用于指示单个像素颜色的位数,要么是指用于指示单个像素每个颜色分量的位数。 它还可以用来确定图像的质量,因为不同的图像 bpp 会导致不同的图像质量(较高的 bpp 通常表示图像清晰度更高)。

可以使用AnyBitmap.FromFile("FILE_PATH")从文件路径读取图像文件。 You can then use .BitsPerPixel on the generated AnyBitmap object to get the color depth of the image.

在 GitHub 上查看

准备开始了吗?

Nuget Downloads 21,321,696版本:2026.11刚刚发布