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

获取颜色深度

颜色深度以每像素比特数 (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 20,274,271版本:2026.11刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥。

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronDrawing
获取您的无义务咨询
您的资料将始终保密。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
深受全球数百万工程师信赖
立即获取您的免费30 天试用密钥。
无需信用卡或创建账户