Batch export SGFs

For discussing go computing, software announcements, etc.
Post Reply
User avatar
Numsgil
Lives in gote
Posts: 614
Joined: Wed Apr 21, 2010 10:07 am
Rank: 1 Kyu KGS
GD Posts: 0
KGS: Numsgil
Has thanked: 28 times
Been thanked: 65 times

Batch export SGFs

Post by Numsgil »

I'm translating problems in the Gokyo Shumyo to SGF format, as I haven't been able to find these anywhere in that format with a permissive license (unless anyone knows of a source?). My goal is to process each problem's SGFs in to 8 different PNGs, for each orientation and color combination. Maybe even add some 'noise' stones to vary the positions a little. And also include a solution PNG for each one (with solutions pulled from Sensei's library, probably). SGF format is nice since it's just plain text and I can goof around with it in Python.

Drago can export positions in to PNGs, but I need some way to automate the process. Is there a way to either batch process SGFs through Drago on the command line or through the GUI or some other SGF to PNG converter that people would recommend? I like the diagrams Drago is spitting out but no way I'm going to go through each generated SGF and export them manually :)
User avatar
leichtloeslich
Lives in gote
Posts: 314
Joined: Wed Feb 29, 2012 1:16 pm
Rank: KGS 4k
GD Posts: 0
Location: Germany
Has thanked: 10 times
Been thanked: 128 times

Re: Batch export SGFs

Post by leichtloeslich »

Why not do it yourself in python?

Check out http://senseis.xmp.net/?GoTypesetting
Also, tikz pgf is nice for graphics in LaTeX.

You might also consider drawing the diagrams in SVG, which can easily be batch-converted to PNG.
User avatar
Numsgil
Lives in gote
Posts: 614
Joined: Wed Apr 21, 2010 10:07 am
Rank: 1 Kyu KGS
GD Posts: 0
KGS: Numsgil
Has thanked: 28 times
Been thanked: 65 times

Re: Batch export SGFs

Post by Numsgil »

Basically I want to do as little effort on this as possible :) Transcribing all the problems in to SGF format is already exhausting, and fiddling around with typesetting to build a SGF-to-something converter isn't my idea of a good time.

So far I've found sgfutils, which is GPL, which is nice. It's aimed at linux, and I'm a windows man, but I was able to get it to compile for windows with some fiddling. It uses the imagemagick command 'convert', and pipes everything to the command line, so I had to install imagemagick for windows and add it to the path. It's managed to blow the command line limit in windows for a few test games I tried doing, but it might do okay with smaller diagrams for problems. It's a passable but not great solution. I'm still looking for something better if anyone finds something.
User avatar
RBerenguel
Gosei
Posts: 1585
Joined: Fri Nov 18, 2011 11:44 am
Rank: KGS 5k
GD Posts: 0
KGS: RBerenguel
Tygem: rberenguel
Wbaduk: JohnKeats
Kaya handle: RBerenguel
Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
Location: Barcelona, Spain (GMT+1)
Has thanked: 576 times
Been thanked: 298 times
Contact:

Re: Batch export SGFs

Post by RBerenguel »

I've made animated gifs from SGF with sgftools. Essentially it does what you want (I've also done some animated tsumegos heh) I'll dig the command if you want, but for the png part it's just sgftools, barebones with imagemagick
Geek of all trades, master of none: the motto for my blog mostlymaths.net
User avatar
tchan001
Gosei
Posts: 1582
Joined: Wed Apr 21, 2010 6:44 pm
GD Posts: 1292
Location: Hong Kong
Has thanked: 54 times
Been thanked: 534 times
Contact:

Re: Batch export SGFs

Post by tchan001 »

http://tchan001.wordpress.com
A blog on Asian go books, go sightings, and interesting tidbits
Go is such a beautiful game.
RobertJasiek
Judan
Posts: 6272
Joined: Tue Apr 27, 2010 8:54 pm
GD Posts: 0
Been thanked: 797 times
Contact:

Re: Batch export SGFs

Post by RobertJasiek »

Try GoWrite, which offers some batch functionality. I have not needed batches, but maybe it has the kind you need.
http://gowrite.net/GOWrite2.html
zorq
Beginner
Posts: 15
Joined: Mon Nov 25, 2013 8:26 pm
GD Posts: 0
Been thanked: 3 times

Re: Batch export SGFs

Post by zorq »

Numsgil wrote:So far I've found sgfutils. It's aimed at linux, and I'm a windows man, but I was able to get it to compile for windows with some fiddling. ... It's managed to blow the command line limit in windows for a few test games I tried doing...
Does the -maxcommandsz option help?
Jaafar
Dies in gote
Posts: 23
Joined: Sun Oct 13, 2013 9:09 pm
GD Posts: 0
Has thanked: 28 times
Been thanked: 1 time

Re: Batch export SGFs

Post by Jaafar »

To convert a large number of sgf files to png with Drago:

  • Put all the sgf files in a folder
  • File > Open folder
  • File > Export
  • In the Games tab choose All or select the sgfs you want to convert
  • Choose in Formats tab: HTML & PNG
  • Change the size of the generated images in layout tab by changing figure ratio an figures per line
  • Click the Goban button and select Zoom on corner
  • Hit Export figures
  • You can rename the 001 part in the first field
  • Enjoy
User avatar
pleiade67
Dies with sente
Posts: 71
Joined: Tue Mar 12, 2013 11:44 am
Rank: 20 kyu
GD Posts: 0
Has thanked: 10 times
Been thanked: 19 times

Re: Batch export SGFs

Post by pleiade67 »

If you haven't already translated all the problems to sgf you may have a look at :
https://github.com/MonsieurCactus/scrapeGo
Post Reply