-- 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()