Enum BitmapCompression
Der Name: Aspose.Imaging.FileFormats.Bmp Versammlung: Aspose.Imaging.dll (25.4.0)
Spezifiziert verschiedene Bitmap-Kompressionsmethoden.
public enum BitmapCompression : uint
Fields
AlphaBitfields = 6
RGBA-Bitfelder. kann nur mit 16 und 32-Bit/Pixel-Bitmaps verwendet werden.
Bitfields = 3
RGB-Bitfelder. kann nur mit 16 und 32-Bit/Pixel-Bitmaps verwendet werden.
Dxt1 = 827611204
DXT1 Kompression. Die Bitmap enthält eine Textur.
Jpeg = 4
JPEG-Kompression: Die Bitmap enthält ein JPEG-Bild.
Png = 5
PNG-Kompression: Die Bitmap enthält ein PNG-Bild.
Rgb = 0
Keine Kompression.
Rle4 = 2
RLE 4-Bit/Pixel Kompression. kann nur mit 4-Bit/Pixel-Bitmaps verwendet werden.
Rle8 = 1
RLE 8-Bit/Pixel Kompression. kann nur mit 8-Bit/Pixel-Bitmaps verwendet werden.
Examples
Das Beispiel zeigt, wie man ein BmpImage mit dem Rgb-Kompressionstyp exportiert.
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 });
}
Das Beispiel zeigt, wie man ein BmpImage aus einem Png-Datei exportiert, während der Alpha-Kanal beibehalten wird und ein Bmp-Datei mit Transparenz speichert.
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 });
}