ImageMagick / ImageMagick6

🧙‍♂️ ImageMagick 6
https://legacy.imagemagick.org
Other
194 stars 80 forks source link

Trouble exporting 8 bit .bmp from Julia wrapper #310

Closed orswan closed 4 months ago

orswan commented 4 months ago

ImageMagick version

6

Operating system

Windows

Operating system, version and so on

Windows 11

Description

I use ImageMagick through the Julia ImageMagick.jl wrapper. I am trying to save an image as an 8 bit .bmp, and am unable to do so. I filed a bug report with a relevant Julia package (https://github.com/JuliaImages/juliaimages.github.io/issues/260), and they informed me that the problem was with ImageMagick itself.

(Unfortunately, I am not sure how to determine which subversion of ImageMagick is being used.)

Steps to Reproduce

In Julia:

using Images, FileIO
#dir = "/path/to/dir"
im_large = n0f16.(Gray.(rand(100,100)))
save(dir * "large.bmp",im_large)
im_small = n0f8.(Gray.(rand(100,100)))
save(dir * "small.bmp",im_small)

Both saved bmp files end up having bit depth 24 on my system.

Images

No response

dlemstra commented 4 months ago

As you mentioned yourself in that other issue you will need to change the image to grayscale. 24 bit is shown on Windows because you have three 8-bit channels. But I don't know the Julia api call that will change the image to grayscale.