取得色彩深度
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剛剛發布