I am trying to save 8-bit bmp files for use with a hardware device*. I am using Julia. Whatever I try, I am only able to get 24-bit bmp files. Here is a minimal working example to illustrate the problem:
using Images, FileIO
dir = "/path/to/dir/"
img = n0f8.(Gray.(rand(100,100)))
save(dir * "image.bmp",img)
If I examine the properties of the resulting image, it is 24 bits. The problem seems to be that, even though the image is grayscale, Julia saves it with three color channels. Apparently 8-bit bmps use a different format, but it is unclear to me whether it is possible to save in this format using Julia.
How can I save an 8-bit .bmp with Julia?
*The hardware is a spatial light modulator, and the 8-bit .bmp format is non-negotiable.
It seems like Images.jl does not support 8-bit .bmp but ".pgm" and ".png" allow 8-bit color depth.