Skip to content

Commit

Permalink
The program now spits out a gif when you feed it with the proper comm…
Browse files Browse the repository at this point in the history
…ands
  • Loading branch information
msglm committed Jan 20, 2021
1 parent 752c796 commit 3470951
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions caption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,19 @@ std::ofstream file { argv[3] }; //create file that will be wrote to

coalesceImages(&coalesced, input.begin(), input.end()); //turns the input image into a coalesced image of all the frames; this makes it akin to a playable gif

for (Image &image : coalesced) { //iterate image memory over coalesced's frames
Image appended;
list <Image> images;
image.backgroundColor("white");
images.push_back(caption_image);
images.push_back(image);
appendImages(&appended, images.begin(), images.end(), true);
appended.repage();
for (Image &image : coalesced) { //iterates over every existing gif frame and add the caption to them
Image appended; //create image appended
list <Image> images; //create list of images called images
image.backgroundColor("white");//adds white background to image
images.push_back(caption_image); //adding caption to the top
images.push_back(image); //adding the image itself
appendImages(&appended, images.begin(), images.end(), true); //apends images to the memory location of appended
appended.repage();
appended.magick("gif"); //type inhereted from https://github.com/esmBot/esmBot/blob/master/commands/caption.js. Just assuming a gif
captioned.push_back(appended);
}
int delay = 1;
//OptimizeImageLayers(&result, captioned.begin(), captioned.end());
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
optimizeImageLayers(&result, captioned.begin(), captioned.end());
for_each(result.begin(), result.end(), animationDelayImage(1));
writeImages(result.begin(), result.end(), argv[3]); //writes image to third argument's location



}

0 comments on commit 3470951

Please sign in to comment.