jnordberg / gif.js

JavaScript GIF encoding library
http://jnordberg.github.io/gif.js/
MIT License
4.74k stars 668 forks source link

options.background not work #61

Open gera2ld opened 7 years ago

gera2ld commented 7 years ago

options.background not work, there is no such property: ctx.setFill.

Ref: https://github.com/jnordberg/gif.js/blob/060595539daeec3cf919754cee398ba0b3ef57f4/src/gif.coffee#L170

1j01 commented 7 years ago

https://github.com/jnordberg/gif.js/pull/46

sucresk commented 7 years ago

var encoder = new GIFEncoder(878,759); encoder.repeat = 0; encoder.delay = 10; encoder.quality = 10; encoder.background = 0xFFFFFF; encoder.setTransparent(0xFFFFFF); pngFileStream('out/goat/Armature-goat_eat_anim_?.png') .pipe(encoder.createWriteStream({})) .pipe(fs.createWriteStream('out/goat_eat.gif')) my code is like this,but the background is still black color. It looks like "background" and "transparent" do not work.

jormaturkenburg commented 7 years ago

ctx.setFill = @options.background in gif.coffee should be: ctx.fillStyle = @options.background I'd submit a pull request except I don't know how. You could just change setFill to fillStyle in gif.js.

edouardmercier commented 5 years ago

The fix proposed by @jormaturkenburg seems the right way to handle this. Do you have any plan for updating the library, please?