4 stable releases

new 1.2.1 Nov 29, 2020
1.2.0 Nov 19, 2020
1.1.0 Nov 16, 2020
1.0.0 Nov 15, 2020

#56 in Images

MIT license

135KB
1.5K SLoC

Sgf Render

Cho Chikun Elementary, Problem 45.

CLI to generate SVG or PNG output from an SGF file.

SVG output is clean and well labeled for easy re-styling or modification.

Supports numbered moves, markup, and several styles.

Installation

Check the releases page on GitHub for pre-built binaries.

Note that the windows, and linux-musl versions are compiled without PNG support. If you need PNG support on a platform without it consider building sgf-render yourself. Alternatively, you can always install ImageMagick to convert the SVG into any format you like.

If you have cargo installed, you can also install the package from crates.io:

$ cargo install sgf-render

Building

If you have git and cargo installed you can also build from source:

$ git clone https://julianandrews/sgf-render
$ cd sgf-render
$ cargo build --release
$ ./target/release/sgf-render -h

Usage

Usage: sgf-render [FILE] [options]

Options:
    -o, --outfile FILE  Output file. SVG and PNG formats supported.
    -n, --node-num NUM  Node number to render (default 1). Note that SGFs may
                        have nodes without moves.
    -w, --width WIDTH   Width of the output image in pixels (default 800)
    -s, --shrink-wrap   Draw only enough of the board to hold all the stones
                        (with 1 space padding)
    -r, --range RANGE   Range to draw as a pair of corners (e.g. 'cc-ff')
        --style STYLE   Style to use. One of 'simple', 'fancy' or 'minimalist'
        --move-numbers  Draw move numbers (disables other markup).
        --no-board-labels
                        Don't draw position labels.
        --no-marks      Don't draw SGF marks.
        --no-triangles  Don't draw SGF triangles.
        --no-circles    Don't draw SGF circles.
        --no-squares    Don't draw SGF squares.
        --no-selected   Don't draw SGF selected.
        --no-dimmed     Don't draw SGF dimmmed.
        --no-labels     Don't draw SGF labels.
        --no-lines      Don't draw SGF lines.
        --no-arrows     Don't draw SGF arrows.
        --first-move-number NUM
                        First move number to draw if using --move-numbers
    -h, --help          Display this help and exit

If FILE isn't provided, sgf-render will read from stdin. If --outfile isn't provided sgf-render will print the resulting SVG to stdout.

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

Feature requests are also welcome! The goal is to make this a general purpose sgf diagram generation tool. Just open an issue at GitHub.

Dependencies

~0.2–3MB
~25K SLoC