A command line tool to make a picture of a chess position

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

A command line tool to make a picture of a chess position

Post by Roland Chastain »

Hello!

I would like to present a very simple command line tool, that makes a picture of a chess position.

https://github.com/rchastain/chess-image

For now it accepts three arguments: an EPD string, the desired size of the picture, and the name of the file to create.

Code: Select all

    chess-image -p "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -" -s 320 -o position.png
    chess-image --position="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -" --size=320 --output=position.png
Maybe I will add more options if someone is interested.

Regards.

Roland
Qui trop embrasse mal étreint.
JohnW
Posts: 381
Joined: Thu Nov 22, 2012 12:20 am
Location: New Hampshire

Re: A command line tool to make a picture of a chess position

Post by JohnW »

Is there an advantage to using the command line instead of using something like Fritz 17 or Arena?
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: A command line tool to make a picture of a chess position

Post by Ovyron »

One advantage would be not needing to use a GUI like Fritz 17 or Arena.
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: A command line tool to make a picture of a chess position

Post by Dann Corbit »

JohnW wrote: Sat Feb 01, 2020 12:06 am Is there an advantage to using the command line instead of using something like Fritz 17 or Arena?
Imagine if you wanted to do 15,000 images.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: A command line tool to make a picture of a chess position

Post by Guenther »

This thread links to two similar tools with batch capability.

http://talkchess.com/forum3/viewtopic.p ... vg#p785948
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: A command line tool to make a picture of a chess position

Post by Roland Chastain »

Thank you for your comments.

Dear Guenther, thank you for the link. I didn't know that Python had a standard chess library. Very interesting.

I could easily add HTML output. I have some code ready for that. If I understand you correctly, by batch capability you mean that the tool accepts as argument an EPD file and generates an HTML document with all positions?
Qui trop embrasse mal étreint.
JohnW
Posts: 381
Joined: Thu Nov 22, 2012 12:20 am
Location: New Hampshire

Re: A command line tool to make a picture of a chess position

Post by JohnW »

Dann Corbit wrote: Sat Feb 01, 2020 5:08 am
JohnW wrote: Sat Feb 01, 2020 12:06 am Is there an advantage to using the command line instead of using something like Fritz 17 or Arena?
Imagine if you wanted to do 15,000 images.
That's a good point, though I can't imagine ever wanting to do that I am sure somebody would.
User avatar
Roland Chastain
Posts: 640
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

chess-image 0.2

Post by Roland Chastain »

Hello!

A new version is available.

https://github.com/rchastain/chess-image/releases

Two options have been added:
  • -f <font> or --font=<font>
  • -c or --coordinates
The possible values for the font parameter are: adventurer, montreal.

The borders with coordinates aren't available for the Chess Montreal font. If you ask the coordinates with that font, the option is ignored without warning.

Regards.

Roland
Qui trop embrasse mal étreint.