public class BmpOptions extends ImageOptionsBase
The bmp file format creation options.
This example demonstrates the use of different classes from SaveOptions Namespace for export purposes. An image of type Gif is loaded into an instance of Image and then exported out to several formats.
String dir = "c:\\temp\\"; //Load an existing image (of type Gif) in an instance of Image class com.aspose.imaging.Image image = com.aspose.imaging.Image.load(dir + "sample.gif"); try { //Export to BMP file format using the default options image.save(dir + "output.bmp", new com.aspose.imaging.imageoptions.BmpOptions()); //Export to JPEG file format using the default options image.save(dir + "output.jpeg", new com.aspose.imaging.imageoptions.JpegOptions()); //Export to PNG file format using the default options image.save(dir + "output.png", new com.aspose.imaging.imageoptions.PngOptions()); //Export to TIFF file format using the default options image.save(dir + "output.tif", new com.aspose.imaging.imageoptions.TiffOptions(com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat.Default)); } finally { image.dispose(); }
Constructor and Description |
---|
BmpOptions()
Initializes a new instance of the
BmpOptions class. |
BmpOptions(BmpOptions bmpOptions)
Initializes a new instance of the
BmpOptions class. |
Modifier and Type | Method and Description |
---|---|
int |
getBitsPerPixel()
Gets or sets the image bits per pixel count.
|
long |
getCompression()
Gets or sets the compression.
|
void |
setBitsPerPixel(int value)
Gets or sets the image bits per pixel count.
|
void |
setCompression(long value)
Gets or sets the compression.
|
deepClone, getBufferSizeHint, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, getXmpData, setBufferSizeHint, setMultiPageOptions, setPalette, setProgressEventHandler, setResolutionSettings, setSource, setVectorRasterizationOptions, setXmpData
close, dispose, getDisposed
public BmpOptions()
Initializes a new instance of the BmpOptions
class.
The following example loads a BMP image and saves it back to BMP using various save options.
String dir = "c:\\temp\\"; com.aspose.imaging.Image image = com.aspose.imaging.Image.load(dir + "sample.bmp"); try { com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image; // Create BmpOptions com.aspose.imaging.imageoptions.BmpOptions saveOptions = new com.aspose.imaging.imageoptions.BmpOptions(); // Use 8 bits per pixel to reduce the size of the output image. saveOptions.setBitsPerPixel(8); // Set the closest 8-bit color palette which covers the maximal number of image pixels, so that a palettized image // is almost visually indistinguishable from a non-palletized one. saveOptions.setPalette(com.aspose.imaging.ColorPaletteHelper.getCloseImagePalette(rasterImage, 256)); // Save without compression. // You can also use RLE-8 compression to reduce the size of the output image. saveOptions.setCompression(com.aspose.imaging.fileformats.bmp.BitmapCompression.Rgb); // Set the horizontal and vertical resolution to 96 dpi. saveOptions.setResolutionSettings(new com.aspose.imaging.ResolutionSetting(96.0, 96.0)); image.save(dir + "sample.bmpoptions.bmp", saveOptions); } finally { image.dispose(); }
public BmpOptions(BmpOptions bmpOptions)
Initializes a new instance of the BmpOptions
class.
bmpOptions
- The BMP options.public int getBitsPerPixel()
Gets or sets the image bits per pixel count.
public void setBitsPerPixel(int value)
Gets or sets the image bits per pixel count.
value
- The image bits per pixel count.The following example loads a BMP image and saves it back to BMP using various save options.
String dir = "c:\\temp\\"; com.aspose.imaging.Image image = com.aspose.imaging.Image.load(dir + "sample.bmp"); try { com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image; // Create BmpOptions com.aspose.imaging.imageoptions.BmpOptions saveOptions = new com.aspose.imaging.imageoptions.BmpOptions(); // Use 8 bits per pixel to reduce the size of the output image. saveOptions.setBitsPerPixel(8); // Set the closest 8-bit color palette which covers the maximal number of image pixels, so that a palettized image // is almost visually indistinguishable from a non-palletized one. saveOptions.setPalette(com.aspose.imaging.ColorPaletteHelper.getCloseImagePalette(rasterImage, 256)); // Save without compression. // You can also use RLE-8 compression to reduce the size of the output image. saveOptions.setCompression(com.aspose.imaging.fileformats.bmp.BitmapCompression.Rgb); // Set the horizontal and vertical resolution to 96 dpi. saveOptions.setResolutionSettings(new com.aspose.imaging.ResolutionSetting(96.0, 96.0)); image.save(dir + "sample.bmpoptions.bmp", saveOptions); } finally { image.dispose(); }
public long getCompression()
Gets or sets the compression.
public void setCompression(long value)
Gets or sets the compression.
value
- The compression.The following example loads a BMP image and saves it back to BMP using various save options.
String dir = "c:\\temp\\"; com.aspose.imaging.Image image = com.aspose.imaging.Image.load(dir + "sample.bmp"); try { com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image; // Create BmpOptions com.aspose.imaging.imageoptions.BmpOptions saveOptions = new com.aspose.imaging.imageoptions.BmpOptions(); // Use 8 bits per pixel to reduce the size of the output image. saveOptions.setBitsPerPixel(8); // Set the closest 8-bit color palette which covers the maximal number of image pixels, so that a palettized image // is almost visually indistinguishable from a non-palletized one. saveOptions.setPalette(com.aspose.imaging.ColorPaletteHelper.getCloseImagePalette(rasterImage, 256)); // Save without compression. // You can also use RLE-8 compression to reduce the size of the output image. saveOptions.setCompression(com.aspose.imaging.fileformats.bmp.BitmapCompression.Rgb); // Set the horizontal and vertical resolution to 96 dpi. saveOptions.setResolutionSettings(new com.aspose.imaging.ResolutionSetting(96.0, 96.0)); image.save(dir + "sample.bmpoptions.bmp", saveOptions); } finally { image.dispose(); }