The Wireless Application Protocol Bitmap Format (WBMP) is designed for use with applications that operate over wireless communication networks. The WBMP format is commonly used in mobile phones (WAP phones) and enables graphical information to be sent to the handset. This format is very simple and allows to store image only in 1-bit format (black and white).
WBMP
image/vnd.wap.wbmp
*.wbmp
Description | Read | Write |
---|---|---|
1 bit palette-based | Yes | Yes |
This code example demonstrates how to convert a JPEG image into the WBMP. Draw attention, to be able to save to the WBMP format, we need to reduce colors to 1-bit color depth first.
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg") bitmap.ColorManagement.ConvertToIndexed(1, Aurigma.GraphicsMill.ColorPaletteType.Bicolor, _ Nothing) bitmap.Save("C:\Mountain.wbmp", _ New Aurigma.GraphicsMill.Codecs.WbmpEncoderOptions) bitmap.Dispose()
using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg")) { bitmap.ColorManagement.ConvertToIndexed(1, Aurigma.GraphicsMill.ColorPaletteType.Bicolor, null); bitmap.Save(@"C:\Mountain.wbmp", new Aurigma.GraphicsMill.Codecs.WbmpEncoderOptions()); }
The code below does the same, but using WbmpWriter class. This class provides more flexible file saving support. In particular, you can use an asynchronous mode.
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg") bitmap.ColorManagement.ConvertToIndexed(1, Aurigma.GraphicsMill.ColorPaletteType.Bicolor, _ Nothing) Dim writer As New Aurigma.GraphicsMill.Codecs.WbmpWriter("C:\Mountain.wbmp") Dim frame As New Aurigma.GraphicsMill.Codecs.WbmpFrame frame.SetBitmap(bitmap) bitmap.Dispose() writer.AddFrame(frame) frame.Dispose() writer.Dispose()
using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg")) { bitmap.ColorManagement.ConvertToIndexed(1, Aurigma.GraphicsMill.ColorPaletteType.Bicolor, null); using (Aurigma.GraphicsMill.Codecs.WbmpWriter writer = new Aurigma.GraphicsMill.Codecs.WbmpWriter()) { using (Aurigma.GraphicsMill.Codecs.WbmpFrame frame = new Aurigma.GraphicsMill.Codecs.WbmpFrame()) { frame.SetBitmap(bitmap); writer.AddFrame(frame); } } }