# save_bitmap

Definition: | integer res = save_bitmap(sequence s, string st)
Description: | Create a bitmap (.bmp) file from a 2-element sequence s. st is the name of a .bmp "bitmap" file. s[1] is the palette: {{r,g,b}, {r,g,b}, ..., {r,g,b}} Each red, green, or blue value is in the range 0 to 255. s[2] is a 2-d sequence of sequences containing a pixel-graphics image. The sequences contained in s[2] must all have the same length. s is in the same format as the value returned by read_bitmap(). The result will be one of the following codes:
        global constant BMP_SUCCESS = 0,
                    BMP_OPEN_FAILED = 1,
                   BMP_INVALID_MODE = 4 -- invalid graphics mode
                                        -- or invalid argument
pwa/p2js: | Not supported
Comments: | 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 may not support 4-color bitmaps.
Example: |
    if save_bitmap({paletteData, imageData},`c:\example\a1.bmp`)!=BMP_SUCCESS then
        crash("unable to save bitmap")
    end if
Implementation: | See builtins\image.e (an autoinclude) for details of the actual implementation.
See Also: | read_bitmap