Enum BitmapCompression

Enum BitmapCompression

名称: Aspose.Imaging.FileFormats.Bmp 收藏: Aspose.Imaging.dll (25.4.0)

指定不同 bitmap 压缩方法。

public enum BitmapCompression : uint

Fields

AlphaBitfields = 6

RGBA 比特字段. 只能使用 16 位和 32 位 / 像素比特地图。

Bitfields = 3

RGB 比特字段. 只能使用 16 位和 32 位 / 像素比特地图。

Dxt1 = 827611204

DXT1 压缩: Bitmap 包含文本。

Jpeg = 4

JPEG 压缩:Bitmap 包含 JPEG 图像。

Png = 5

PNG 压缩:Bitmap 包含 PNG 图像。

Rgb = 0

没有压缩。

Rle4 = 2

RLE 4 位/像素压缩. 只能使用 4 位/像素比特图。

Rle8 = 1

RLE 8 位 / 像素压缩. 只能使用 8 位 / 像素比特图。

Examples

示例显示如何用 Rgb 压缩类型出口 BmpImage。

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 });
                                                                                    }

示例显示如何从 Png 文件中导出 BmpImage 同时保持 Alpha 频道,以透明度保存 Bmp 文件。

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 });
                                                                                                                                         }
 中文