Enum BitmapCompression

Enum BitmapCompression

Le nom : Aspose.Imaging.FileFormats.Bmp Assemblée: Aspose.Imaging.dll (25.4.0)

Il spécifie différentes méthodes de compression de bitmap.

public enum BitmapCompression : uint

Fields

AlphaBitfields = 6

Il peut être utilisé uniquement avec des bitmaps de 16 et 32 bits/pixels.

Bitfields = 3

Les champs bit RGB ne peuvent être utilisés que avec des bitmaps de 16 et 32 bits/pixels.

Dxt1 = 827611204

DXT1 compression. le bitmap contient une texture.

Jpeg = 4

Compression JPEG. Le bitmap contient une image JPEG.

Png = 5

Compression PNG. La carte bit contient une image PNG.

Rgb = 0

Nessuna compressione.

Rle4 = 2

Compression RLE 4 bits/pixels. ne peut être utilisé que avec des bitmaps 4 bits/pixels.

Rle8 = 1

Compression RLE 8 bits/pixels. Il ne peut être utilisé que avec des bitmaps 8 bits/pixels.

Examples

L’exemple montre comment exporter un BmpImage avec le type de compression 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 montre comment exporter un BmpImage d’un fichier Png tout en gardant le canal alpha, en sauvegardant un fichie BMP avec transparence.

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 });
                                                                                                                                         }
 Français