Enum BitmapCompression
Nome do espaço: Aspose.Imaging.FileFormats.Bmp Assembleia: Aspose.Imaging.dll (25.4.0)
Determina diferentes métodos de compressão de bitmap.
public enum BitmapCompression : uint
Fields
AlphaBitfields = 6
RGBA bit campos. pode ser usado apenas com 16 e 32-bit/pixel bitmaps.
Bitfields = 3
Os campos de bit RGB podem ser usados apenas com 16 e 32 bits/pixel.
Dxt1 = 827611204
DXT1 compressão. o bitmap contém uma textura.
Jpeg = 4
Compressão JPEG: o bitmap contém uma imagem JPEG.
Png = 5
Compressão PNG. O bitmap contém uma imagem PNG.
Rgb = 0
Sem compressão.
Rle4 = 2
RLE compressão de 4 bits/pixel. pode ser usado apenas com bitmaps de 4 bits/pixel.
Rle8 = 1
RLE compressão de 8 bits/pixel. pode ser usado apenas com bitmaps de 8 bits/pixel.
Examples
O exemplo mostra como exportar um BmpImage com o tipo de compressão 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 });
}
O exemplo mostra como exportar um BmpImage de um arquivo Png enquanto mantém o canal alfa, salvando um arquivo Bmp com 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 });
}