Enum BitmapCompression
Tên không gian: Aspose.Imaging.FileFormats.Bmp Tổng hợp: Aspose.Imaging.dll (25.4.0)
Định nghĩa các phương pháp nhỏ gọn bitmap khác nhau.
public enum BitmapCompression : uint
Fields
AlphaBitfields = 6
RGBA bit fields. có thể được sử dụng chỉ với 16 và 32-bit/pixel bitmaps.
Bitfields = 3
RGB bit fields. có thể được sử dụng chỉ với 16 và 32-bit/pixel bitmaps.
Dxt1 = 827611204
DXT1 Compression.Bitmap chứa một cấu trúc.
Jpeg = 4
JPEG Compression.Bitmap chứa một hình ảnh JPEG.
Png = 5
PNG Compression.Bitmap chứa một hình ảnh PNG.
Rgb = 0
Không có compression.
Rle4 = 2
RLE 4 bit/pixel compression. có thể được sử dụng chỉ với 4 bit/pixel bitmaps.
Rle8 = 1
RLE 8-bit/pixel compression. có thể được sử dụng chỉ với 8-bit/pixel bitmaps.
Examples
Ví dụ cho thấy làm thế nào để xuất một BmpImage với loại nén Rgb.
string sourcePath = "input.png";
// Load a PNG image from a file.
using (Image pngImage = Image.Load(sourcePath))
{
// BMP image is saved with transparency support by default, that is achieved by using the BitmapCompression.Bitfields compression method.
// To save a BMP image with the Rgb compression method, the BmpOptions with the Compression property set to BitmapCompression.Rgb should be specified.
pngImage.Save(outputPath, new BmpOptions() { Compression = BitmapCompression.Rgb });
}
Ví dụ này cho thấy làm thế nào để xuất một BmpImage từ một tệp Png trong khi giữ kênh alpha, tiết kiệm tập tin bmp với minh bạch.
string sourcePath = "input.png";
// Load a PNG image from a file.
using (Image pngImage = Image.Load(sourcePath))
{
// BMP image is saved with transparency support by default.
// If you want to explicitly specify such mode, the BmpOptions's Compression property should be set to BitmapCompression.Bitfields.
// The BitmapCompression.Bitfields compression method is the default compression method in the BmpOptions.
// So the same result of exporting a Bmp image with transparency can be achieved by either one of the following ways.
// With an implicit default options:
pngImage.Save(outputPath);
// With an explicit default options:
pngImage.Save(outputPath, new BmpOptions());
// Specifying the BitmapCompression.Bitfields compression method:
pngImage.Save(outputPath, new BmpOptions() { Compression = BitmapCompression.Bitfields });
}