This documentation is for the old version. Go to the latest Graphics Mill docs

BmpWriter Class

This class enables you to write BMP images.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public NotInheritable Class BmpWriter _
	Inherits FormatWriter
C#
public sealed class BmpWriter : FormatWriter

Remarks

BMP (Bitmap) is a standard image format mainly used on the Microsoft Windows platform. BMP images can range from black and white (1 bit per pixel) up to 32 bit color (16.7 million colors), in that way bitmap image format can store both indexed and true color images. There are two main BMP formats exist: Windows bitmap formats and OS/2 bitmap format. All of these formats supports RLE-type compression for 4 and 8 bits per pixel palette images.

BMP files can store only single image per file.

Examples

You can use BmpWriter class instead of the Save(String, IEncoderOptions) method of the Bitmap. In particular it enables you to save the image asynchronously.

The BmpWriter class usage is demonstrated below:

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg")

Dim writer As New Aurigma.GraphicsMill.Codecs.BmpWriter("C:\Mountain.bmp")

Dim frame As New Aurigma.GraphicsMill.Codecs.BmpFrame( _
    Aurigma.GraphicsMill.Codecs.CompressionType.None)

frame.SetBitmap(bitmap)

bitmap.Dispose()

writer.AddFrame(frame)

frame.Dispose()

writer.Dispose()
C#
using (Aurigma.GraphicsMill.Bitmap bitmap = 
           new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg"))
{
    using (Aurigma.GraphicsMill.Codecs.BmpWriter writer = 
        new Aurigma.GraphicsMill.Codecs.BmpWriter())
    {
        writer.Open(@"C:\Mountain.bmp");

        using (Aurigma.GraphicsMill.Codecs.BmpFrame frame = 
                   new Aurigma.GraphicsMill.Codecs.BmpFrame())
        {
            frame.Compression = Aurigma.GraphicsMill.Codecs.CompressionType.None;
            frame.SetBitmap(bitmap);

            writer.AddFrame(frame);
        }
    }
}

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model





Supported Pixel Formats

Member NameDescription
Format1bppIndexed1 bit per pixel. Indexed.
Format4bppIndexed4 bits per pixel. Indexed.
Format8bppIndexed8 bits per pixel. Indexed.
Format8bppGrayScale8 bits per pixel. Grayscale. 8 bits are used for luminosity level.
Format24bppRgb24 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components.
Format32bppRgb32 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. The rest 8 bits are unused.
Format32bppArgb32 bits per pixel. RGB with alpha channel. 8 bits each are used for the alpha, red, green, and blue components.

See Also

Reference