JuliaIO / JuliaIO/FileIO.jl

Incorrectly export GIF image

Open
#368 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
228
Forks
81
Avg merge
1d 29m
Merged PRs (30d)
1

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the Julia FileIO.save and load examples for all-ones and mostly-ones Bool matrices. Start by tracing GIF handling through FileIO and the suspected ImageMagick.jl wrapper; done means saving and loading these matrices no longer turns a mostly-one image into an all-zero image.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.