BmpImage Constructor (String, UInt16, BitmapCompression, Double, Double)
Initializes a new instance of the BmpImage class.

Namespace: Aspose.Imaging.FileFormats.Bmp
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
Syntax
public BmpImage(
	string path,
	ushort bitsPerPixel,
	BitmapCompression compression,
	double horizontalResolution,
	double verticalResolution
)

Parameters

path
Type: SystemString
The path to load image from and initialize pixel and palette data with.
bitsPerPixel
Type: SystemUInt16
The bits per pixel.
compression
Type: Aspose.Imaging.FileFormats.BmpBitmapCompression
The compression to use.
horizontalResolution
Type: SystemDouble
The horizontal resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
verticalResolution
Type: SystemDouble
The vertical resolution. Note due to the rounding the resulting resolution may slightly differ from the passed.
Exceptions
ExceptionCondition
ArgumentNullExceptionThe raster image cannot be null;rasterImage
BmpImageExceptionThe height should be positive.
ArgumentExceptionPalette should be specified for images with 8 bits per pixel or less.;palette
Examples
The example shows how to load a BmpImage from a file with the specified bit depth and resolution.
[C#]

string dir = "c:\\temp\\";

// Load a BMP image from a file.
// The source pixels will be converted to 24-bpp format if required.
// The resolution will be set to 96 dpi.
using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage =
    new Aspose.Imaging.FileFormats.Bmp.BmpImage(dir + "sample.bmp", 24, Aspose.Imaging.FileFormats.Bmp.BitmapCompression.Rgb, 96.0, 96.0))
{
    // Do some image processing.
    // Save to another BMP file.
    bmpImage.Save(dir + "sample.output.24bpp.96dpi.bmp");
}
See Also