FileIO.jl icon indicating copy to clipboard operation
FileIO.jl copied to clipboard

Incorrectly export GIF image

Open RexWzh opened this issue 3 years ago • 1 comments

By save("xxx.gif", bitmat), one should get a white picture, however, the output is black.

using FileIO
save("one.gif", ones(Bool, 200, 200)) # get a black image
load("one.gif") |> iszero # true

small

More generally, when the rate of zeros is small enough, the ones-matrix is treated as a zeros-matrix.

a = ones(Bool, 200, 200)
# set zero on a small range
ind = rand(1:40000, 300)
a[ind] .= false
save("small.gif", a) 
load("small.gif") |> iszero # true again
# set zero on more place
ind = rand(1:40000, 3000)
a[ind] .= false
save("normal.gif", a) # now we get the right image

normal


This issue occurs only in the case of gif, might have to do with the wrapper of ImageMagick.jl?

RexWzh avatar Dec 08 '22 07:12 RexWzh

Right this doesn't have to do with FileIO. ImageMagick.jl is in the process of being updated, so perhaps keep an eye on it.

ViralBShah avatar Oct 12 '24 14:10 ViralBShah