updating oE save_bitmap


include image.e 
namespace image 
public function save_bitmap(two_seq palette_n_image, sequence file_name) 

create a .BMP bitmap file, given a palette and a 2-d sequence of sequences of colors.

  1. palette_n_image : a {palette, image} pair, like read_bitmap returns
  2. file_name : a sequence, the name of the file to save to.

An integer, 0 on success.


This routine does the opposite of read_bitmap(). The first element of palette_n_image is a list of sequences each sequence containing exactly three color intensity values in the range 0 to 255. The second element is a list of sequences of colors. The inner sequences must have the same length. Each element in the each inner sequence represents the color index in palette_n_image of a pixel. Each inner sequence is a row in the image.

The result will be one of the following codes:

public constant 
    BMP_SUCCESS = 0, 
    BMP_INVALID_MODE = 4 -- invalid graphics mode 
                         -- or invalid argument 

save_bitmap produces bitmaps of 2, 4, 16, or 256 colors and these can all be read with read_bitmap. Windows Paintbrush and some other tools do not support 4-color bitmaps.

Example 1:
code = save_bitmap({paletteData, imageData}, 
See Also:


Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu