BmpImage Constructor (Stream)
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(
	Stream stream
)

Parameters

stream
Type: System.IOStream
The stream to load image from and initialize pixel and palette data with.
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 stream.
[C#]

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

// Load a BMP image from a file stream.
// The source pixels will be converted to 32-bpp format if required.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.bmp"))
{
    using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(stream))
    {
        // Do some image processing.
        // Save to another BMP file.
        bmpImage.Save(dir + "sample.output.32bpp.bmp");
    }
}
See Also