Use addFrame or addFrameImageData for more than two image, and 'getBase64GIF' to generate the gif, result get error, the first image does not display when the second image appear.
let gif = new Animated_GIF();
for (let i = 0; i < fileList.length; i++) {
let img = fileList[i];
gif.setSize(img.width, img.height);
gif.addFrame(img);
if (i==fileList.length-1) {
gif.getBase64GIF(b64=>{
let el = document.createElement('a');
el.href = URL.createObjectURL(base64ToBlob(b64));
el.download = 'file.gif';
document.body.appendChild(el);
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
el.dispatchEvent(evt);
document.body.removeChild(el);
})
}
}
Use addFrame or addFrameImageData for more than two image, and 'getBase64GIF' to generate the gif, result get error, the first image does not display when the second image appear.
let gif = new Animated_GIF(); for (let i = 0; i < fileList.length; i++) { let img = fileList[i]; gif.setSize(img.width, img.height); gif.addFrame(img); if (i==fileList.length-1) { gif.getBase64GIF(b64=>{ let el = document.createElement('a'); el.href = URL.createObjectURL(base64ToBlob(b64)); el.download = 'file.gif'; document.body.appendChild(el); let evt = document.createEvent("MouseEvents"); evt.initEvent("click", false, false); el.dispatchEvent(evt); document.body.removeChild(el); }) } }