获取颜色深度
颜色深度以每像素位数或bpp来衡量,用于提供关于颜色组件的信息,包括用于表示单个像素的颜色的位数或用于单个像素的每个颜色组件的位数。 它也可用于在某个时候确定图像的质量,因为不同的图像bpp会导致图像的结果质量不同(bpp越高,图像定义越高)。
要读取的图像文件可以从文件路径加载AnyBitmap.FromFile(@"FILE_PATH")。 .BitsPerPixel 然后可以用于生成的 AnyBitmap 来获取颜色深度。
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
Private sample As AnyBitmap = AnyBitmap.FromFile("FILE_PATH")
' Gets and prints the color depth in terms of bits per pixel
Private colorDepth = sample.BitsPerPixel
Console.WriteLine(colorDepth)Install-Package IronSoftware.System.Drawing
颜色深度以每像素位数或bpp来衡量,用于提供关于颜色组件的信息,包括用于表示单个像素的颜色的位数或用于单个像素的每个颜色组件的位数。 它也可用于在某个时候确定图像的质量,因为不同的图像bpp会导致图像的结果质量不同(bpp越高,图像定义越高)。
要读取的图像文件可以从文件路径加载AnyBitmap.FromFile(@"FILE_PATH")。 .BitsPerPixel 然后可以用于生成的 AnyBitmap 来获取颜色深度。