Enum BitmapCompression
Названий на: Aspose.Imaging.FileFormats.Bmp Асамблея: Aspose.Imaging.dll (25.4.0)
Визначте різні методи компресії bitmap.
public enum BitmapCompression : uint
Fields
AlphaBitfields = 6
Використовується тільки з 16 і 32-бітними/піксельними бітмапами.
Bitfields = 3
Використовується тільки з 16 і 32-бітними / піксельними бітмапами.
Dxt1 = 827611204
DXT1 компресія. bitmap містить текстуру.
Jpeg = 4
JPEG компресія. bitmap містить JPEG зображення.
Png = 5
Компресія PNG. Бітмапа містить зображення PNG.
Rgb = 0
Немає компресії
Rle4 = 2
Компресія RLE 4-біт/піксель. можна використовувати тільки з 4-біт/піксель bitmaps.
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 при збереженні альфа-каналу, зберігаючи файл BMP з прозорості.
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 });
}