JuliaIO / ImageMagick.jl

Thin Wrapper for the library ImageMagick
Other
53 stars 37 forks source link

failures when saving a matrix of bools or bitmatrix to png then reloading #233

Open greghislop opened 2 months ago

greghislop commented 2 months ago

When attempting to save a bitmatrix to a png using a random assignment of trues and falses and then loading the file back in again, I get the expected results of the two matrices being equal. When saving a matrix of all true values or almost all true values with just one or two set to false the result when reloading the file is a matrix of all zero values.

eg. using ImageMagick a=rand(Bool,500,500); ImageMagick.save("test.png", a);

Produces a 1 bit grayscale png as expected, and

ImageMagick.load("test.png") == a

evaluates as true as expected. However

a=falses(500,500); a[1,101]=true; ImageMagick.load("test.png") == a

evaluates as false while the following is true

ImageMagick.load("test.png") == falses(500,500)

This was done on julia 1.8.5, but I understand it to also fail on much later versions. Any suggestions most welcome