Forum for Drago

Animated Gif [#3004]

Back to forum     Back to page

New reply

reply Animated Gif (2014-04-18 10:07) [#10050]


I saw that Drago could export go games using gif format. Is it possible to export an animated gif displaying the game from the beginning to the end of the game? If not, does anyone know how to do this?

Anyway, thanks for this wonderful software!

Cheers, Johan

X Re: Animated Gif (2014-04-18 23:15) [#10051]

Assuming you have created your images, named game001.png to game100.png (for each board position from move 1 to move 100), then with imagemagick installed, the command

convert -delay 50 -loop 0 game*.png animate.gif

will create an animated gif from these images.
One way to automate the creation of these pngs is to use [ext] this Sgf thumbnailer and the following perl script with the name of the sgf file and the desired number of moves supplied as arguments. [ext] Example output.
Using Windows, you would need to install perl, imagemagick and then copy the script below into the thumbnailer directory.

use sgfThumbnailer;

my ($in, $movenumber) = @ARGV;
my $writer = new sgfThumbnailer();

for (1..$movenumber) {

 $writer->makeimage($in, join '', 'game', sprintf("%03d", $_), '.png');

} Re: Animated Gif (2014-04-19 17:49) [#10053]

A video format can result in a file 5-10 times smaller than an animated gif. On a linux box the command

avconv -r 2 -i game%03d.jpg video.avi

would create such a thing (I found i had to convert the images to jpgs first (mogrify -format jpg *.png)) Re: Animated Gif (2014-04-22 10:31) [#10059]

Thanks for your replies, I will try your suggestions. I think that embedding such a gif on a webpage is easier and simplier than putting the SGF file or an online SGF editor.

RBerenguel: ((no subject)) (2014-04-19 14:37) [#10052]

I use sgfutils (see here for example: [ext] within a bash script to generate an image per move and then gifsicle (it's faster and more polished for this job, it's a great tool for any other animated gif use case) to generate the final animated gif.

Back to forum     Back to page

New reply

[Welcome to Sensei's Library!]
Search position
Page history
Latest page diff
Partner sites:
Go Teaching Ladder
Login / Prefs
Sensei's Library