Enum BitmapCompression
Nazwa przestrzeń: Aspose.Imaging.FileFormats.Bmp Zgromadzenie: Aspose.Imaging.dll (25.4.0)
Wyznacza różne metody kompresji bitmap.
public enum BitmapCompression : uint
Fields
AlphaBitfields = 6
Pole bitowe RGBA. mogą być używane tylko z 16 i 32-bit/pixel bitmaps.
Bitfields = 3
Pole bitowe RGB. mogą być używane tylko z 16 i 32-bit/pixel bitmaps.
Dxt1 = 827611204
DXT1 kompresja. bitmap zawiera teksturę.
Jpeg = 4
Kompresja JPEG. Bitmap zawiera obraz JPEG.
Png = 5
Kompresja PNG. Bitmap zawiera obraz PNG.
Rgb = 0
Bez kompresji
Rle4 = 2
Kompresja RLE 4-bit/pixel.Może być używana tylko z 4-bit/pixel bitmaps.
Rle8 = 1
Kompresja RLE 8-bit/pixel. może być używany tylko z 8-bit/pixel bitmaps.
Examples
Przykład pokazuje, jak eksportować BmpImage z typem kompresji 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 });
}
Przykład pokazuje, jak wyeksportować plik BmpImage z pliku Png podczas utrzymania kanału alfa, oszczędzając pliki BMP z przejrzystością.
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 });
}