Enum BitmapCompression
Името на пространството: Aspose.Imaging.FileFormats.Bmp Асамблея: Aspose.Imaging.dll (25.4.0)
Определя различни методи за компресия на битмапи.
public enum BitmapCompression : uint
Fields
AlphaBitfields = 6
RGBA битови полета. може да се използва само с 16 и 32-битови / пикселни битови карти.
Bitfields = 3
RGB битови полета. могат да се използват само с 16 и 32-битови / пикселни битови карти.
Dxt1 = 827611204
DXT1 компресия. bitmap съдържа текстура.
Jpeg = 4
JPEG компресия: Битмапата съдържа изображение на JPG.
Png = 5
ПНГ компресия. Битмапа съдържа PNG изображение.
Rgb = 0
Няма компресия
Rle4 = 2
RLE 4 бита/пиксел компресия. може да се използва само с 4-битни / пикселни битмапи.
Rle8 = 1
RLE компресия от 8 бита/пиксел. може да се използва само с 8-битни / пикселни битмапи.
Examples
Примерът показва как да експортирате BmpImage с типа 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 });
}
Примерът показва как да експортирате BmpImage от файла Png, докато поддържате алфа канала, спестявайки файл с прозрачност.
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 });
}