8bmp Module
8.1Overview
The bmp
module provides measures to read/write image data in Microsoft BMP format. To utilize it, import the bmp
module using import
function.
Below is an example to read a BMP file:
import(bmp)
img = image('foo.bmp')
8.2Exntension to Function's Capability
The bmp
module extends the capability of function image()
and instance method image#write()
so that they can read/write BMP files.
When function image()
is provided with a stream that satisfies the following conditions, it would recognize the stream as a BMP file.
- The identifier of the stream ends with a suffix "
.bmp
". - The stream data begins with a byte sequence "
BM
".
When instance method image#write()
is provided with a stream that satisfies the following condition, it would write image data in BMP format.
- The identifier of the stream ends with a suffix "
.bmp
".
8.3Extension to image Class
The bmp
module extends the image
class with following methods:
image#read@bmp(stream:stream:r):reduce
Reads an BMP image from a stream.
This method returns the reference to the target instance itself.
image#write@bmp(stream:stream:w):reduce
Writes a BMP image to a stream.
This method returns the reference to the target instance itself.