Enum BitmapCompression
ja nimityö: Aspose.Imaging.FileFormats.Bmp Kokoelma: Aspose.Imaging.dll (25.4.0)
Erilaiset bitmap-kompressiomenetelmät.
public enum BitmapCompression : uint
Fields
AlphaBitfields = 6
Voidaan käyttää vain 16 ja 32 bitin / pikselin bitmapien kanssa.
Bitfields = 3
Voidaan käyttää vain 16 ja 32 bitin / pikselin bitmapien kanssa.
Dxt1 = 827611204
DXT1 kompressi. bitmap sisältää tekstin.
Jpeg = 4
JPEG-kompressio. bitmap sisältää JPEG-kuvan.
Png = 5
PNG-kompressio. bitmap sisältää PNG-kuvan.
Rgb = 0
Ei mikään kompressi
Rle4 = 2
RLE 4-bittinen / pikselin kompressio. voidaan käyttää vain 4-bittisillä / pikselin bitmapsilla.
Rle8 = 1
RLE 8-bittinen / pikselin kompressio. voidaan käyttää vain 8-bittisillä / pikselin bitmapsilla.
Examples
Esimerkki näyttää, miten viedä BmpImage Rgb-kompressiotyypillä.
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 });
}
Esimerkki osoittaa, miten viedä BmpImage Png-tiedostosta pitämällä alfa-kanavaa ja säästää bmp tiedostoa läpinäkyvyyteen.
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 });
}