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 บิต / พิกเซล bitmaps

Bitfields = 3

RGB bit fields สามารถใช้ได้เฉพาะกับ 16 และ 32 บิต / พิกเซล bitmaps

Dxt1 = 827611204

DXT1 การบีบอัด บิตการ์ดประกอบด้วยข้อความ

Jpeg = 4

การบีบอัด JPEG บิตการ์ดประกอบด้วยภาพ JPEG

Png = 5

การบีบอัด PNG บิตการ์ดมีภาพ PNG

Rgb = 0

ไม่มีการบีบอัด

Rle4 = 2

RLE การบีบอัด 4 บิต / พิกเซล สามารถใช้ได้เฉพาะกับ 4 บิต / พิกเซล bitmaps

Rle8 = 1

การบีบอัด RLE 8-bit/pixel สามารถใช้ได้เฉพาะกับ bitmaps 8-bit/pixel

Examples

ตัวอย่างแสดงให้เห็นว่าวิธีการส่งออก BmpImage กับประเภทการบีบอัด 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 });
                                                                                    }

ตัวอย่างนี้แสดงให้เห็นวิธีการส่งออกไฟล์ BmpImage จากไฟล์ Png ในขณะที่เก็บช่อง 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 });
                                                                                                                                         }
 แบบไทย