public final class BitmapCompression
extends com.aspose.ms.System.Enum
Specifies different bitmap compression methods.
The example shows how to export a BmpImage from a Png file while keeping the alpha channel, save a Bmp file with transparency.
String sourcePath = "input.png";
String outputPathPng = "output.png";
String outputPathBmp = "output.bmp";
// Load a PNG image from a file.
try (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(outputPathPng);
// With an explicit default options:
pngImage.save(outputPathBmp, new BmpOptions());
// Specifying the BitmapCompression.Bitfields compression method:
pngImage.save(outputPathBmp, new BmpOptions() {{ setCompression(BitmapCompression.Bitfields); }});
}
| Modifier and Type | Field and Description |
|---|---|
static long |
AlphaBitfields
RGBA bit fields.
|
static long |
Bitfields
RGB bit fields.
|
static long |
Dxt1
DXT1 compression.
|
static long |
Jpeg
JPEG compression.
|
static long |
Png
PNG compression.
|
static long |
Rgb
No compression.
|
static long |
Rle4
RLE 4-bit/pixel compression.
|
static long |
Rle8
RLE 8-bit/pixel compression.
|
Clone, CloneTo, format, format, get_Caption, get_Value, getName, getName, getNames, getNames, getNames, getUnderlyingType, getUnderlyingType, getValue, getValues, getValues, getValues, isDefined, isDefined, isDefined, isDefined, isDefined, parse, parse, parse, parse, register, toObject, toString, toStringpublic static final long Rgb
No compression.
public static final long Rle8
RLE 8-bit/pixel compression. Can be used only with 8-bit/pixel bitmaps.
public static final long Rle4
RLE 4-bit/pixel compression. Can be used only with 4-bit/pixel bitmaps.
public static final long Bitfields
RGB bit fields. Can be used only with 16 and 32-bit/pixel bitmaps.
public static final long Jpeg
JPEG compression. The bitmap contains a JPEG image.
public static final long Png
PNG compression. The bitmap contains a PNG image.
public static final long AlphaBitfields
RGBA bit fields. Can be used only with 16 and 32-bit/pixel bitmaps.
public static final long Dxt1
DXT1 compression. The bitmap contains a texture.
Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.