BitMap.Save(b, FileName) writes the BitMap object b to the file FileName as a bmp image, which most image viewers and web browsers can open. The file keeps the transparency of the pixels. An existing file of that name is overwritten.
None; the file is written.
The file has 32 bits per pixel, red, green, blue and the opacity, and a header of 138 bytes, so a bitmap of NX by NY pixels gives a file of $138 + 4\, NX\, NY$ bytes.
A bitmap of 256 by 256 pixels with red increasing from left to right and blue from bottom to top, written as a bmp file.
-- a bitmap of 256 by 256 pixels: red increases from left to right, blue from bottom to top b = BitMap.New(256, 256) for i = 1, 256 do for j = 1, 256 do BitMap.Pixel(b, i, j, 0x010000*(i-1) + 0x000001*(256-j)) end end BitMap.Save(b, "Gradient.bmp") -- the file has a header of 138 bytes and 4 bytes per pixel file = io.open("Gradient.bmp", "rb") print("Gradient.bmp has "..file:seek("end").." bytes") file:close()
Gradient.bmp has 262282 bytes
The file Gradient.bmp: