Enum BitmapCompression

Enum BitmapCompression

Nom dels espais: Aspose.Imaging.FileFormats.Bmp Assemblea: Aspose.Imaging.dll (25.4.0)

Especifica diferents mètodes de compressió de bitmap.

public enum BitmapCompression : uint

Fields

AlphaBitfields = 6

Es pot utilitzar només amb bitmaps de 16 i 32 bits/pixel.

Bitfields = 3

Es pot utilitzar només amb bitmaps de 16 i 32 bits/pixel.

Dxt1 = 827611204

DXT1 compressió. el bitmap conté una textura.

Jpeg = 4

Compressió JPEG. El bitmap conté una imatge JPeg.

Png = 5

Compressió PNG. El bitmap conté una imatge de png.

Rgb = 0

No hi ha compressi.

Rle4 = 2

RLE compressió de 4 bits / píxels. Es pot utilitzar només amb bitmaps de 4-bit / pixel.

Rle8 = 1

RLE compressió de 8 bits / píxels. Es pot utilitzar només amb bitmaps de 8-bit / pixel.

Examples

L’exemple mostra com exportar un BmpImage amb el tipus de compressió 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 });
                                                                                    }

L’exemple mostra com exportar un BmpImage d’un arxiu Png mentre manté el canal alfa, guardant un fitxer BMP amb transparència.

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