Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIF generation is not working correctly #557

Closed
tech4GT opened this issue Dec 26, 2018 · 6 comments · Fixed by #561
Closed

GIF generation is not working correctly #557

tech4GT opened this issue Dec 26, 2018 · 6 comments · Fixed by #561
Labels

Comments

@tech4GT
Copy link
Member

tech4GT commented Dec 26, 2018

Gif generation is picking up the images produced in the thumbnails too!(brightness, contrast, saturation, rotate and crop).
We just want the step outputs in the gif and not these preview images.
cc @jywarren @Mridul97

@gitmate
Copy link

gitmate bot commented Dec 26, 2018

GitMate.io thinks possibly related issues are #213 (Crop Module not working correctly), #427 (Download and download as gif button not working in image sequencer), #285 (Colorbar generation module), #436 (Enhance gif view), and #386 (Link in the description does not work as required).

1 similar comment
@gitmate
Copy link

gitmate bot commented Dec 26, 2018

GitMate.io thinks possibly related issues are #213 (Crop Module not working correctly), #427 (Download and download as gif button not working in image sequencer), #285 (Colorbar generation module), #436 (Enhance gif view), and #386 (Link in the description does not work as required).

@gitmate gitmate bot added the bug label Dec 26, 2018
@harshkhandeparkar
Copy link
Member

@tech4GT, in which file is the gif generation done?

@harshkhandeparkar
Copy link
Member

harshkhandeparkar commented Dec 26, 2018

I actually found it in demo.js. It is a pretty easy fix. It is linked to my last rearrange-sequence-buttons PR. Should I fix this?

@tech4GT
Copy link
Member Author

tech4GT commented Dec 26, 2018

var isWorkingOnGifGeneration = false;
$('.js-view-as-gif').on('click', function(event) {
// Prevent user from triggering generation multiple times
if (isWorkingOnGifGeneration) return;
isWorkingOnGifGeneration = true;
var button = event.target;
button.disabled = true;
try {
// Select all images from previous steps
var imgs = document.getElementsByClassName("img-thumbnail");
var imgSrcs = [];
for (var i = 0; i < imgs.length; i++) {
imgSrcs.push(imgs[i].src);
}
var options = {
'gifWidth': imgs[0].width,
'gifHeight': imgs[0].height,
'images': imgSrcs,
'frameDuration': 7,
}
gifshot.createGIF(options, function(obj) {
if (!obj.error) {
// Final gif encoded with base64 format
var image = obj.image;
var animatedImage = document.createElement('img');
animatedImage.id = "gif_element";
animatedImage.src = image;
var modal = $('#js-download-gif-modal');
$("#js-download-as-gif-button").one("click", function() {
// Trigger download
download(image, "index.gif", "image/gif");
// Close modal
modal.modal('hide');
})
var gifContainer = document.getElementById("js-download-modal-gif-container");
// Clear previous results
gifContainer.innerHTML = '';
// Insert image
gifContainer.appendChild(animatedImage);
// Open modal
modal.modal();
button.disabled = false;
isWorkingOnGifGeneration = false;
}
});
}
catch (e) {
console.error(e);
button.disabled = false;
isWorkingOnGifGeneration = false;
}
});

@tech4GT
Copy link
Member Author

tech4GT commented Dec 26, 2018

Yeah go ahead @harshkhandeparkar :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants