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: Harvey Williamson, bob, hgm

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
User avatar
Roland Chastain
Posts: 415
Joined: Sat Jun 08, 2013 8:07 am
Location: France
Full name: Roland Chastain
Contact:

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

Post by Roland Chastain » Fri Jan 31, 2020 8:29 pm

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: 202
Joined: Wed Nov 21, 2012 11:20 pm
Location: New Hampshire

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

Post by JohnW » Fri Jan 31, 2020 11:06 pm

Is there an advantage to using the command line instead of using something like Fritz 17 or Arena?

User avatar
Ovyron
Posts: 4399
Joined: Tue Jul 03, 2007 2:30 am

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

Post by Ovyron » Fri Jan 31, 2020 11:48 pm

One advantage would be not needing to use a GUI like Fritz 17 or Arena.

Dann Corbit
Posts: 11626
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

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

Post by Dann Corbit » Sat Feb 01, 2020 4:08 am

JohnW wrote:
Fri Jan 31, 2020 11:06 pm
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.

Guenther
Posts: 3436
Joined: Wed Oct 01, 2008 4:33 am
Location: Regensburg, Germany
Full name: Guenther Simon
Contact:

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

Post by Guenther » Sat Feb 01, 2020 7:48 am

This thread links to two similar tools with batch capability.

viewtopic.php?f=2&t=69576&hilit=epd2svg#p785948
https://rwbc-chess.de
Greg Strong@ovyron wrote: What I think is that you have a very, very, VERY strong desire to post, and very little self-control.
All the time. In every conversation. You must post. Something. It's like you just can't help yourself.

User avatar
Roland Chastain
Posts: 415
Joined: Sat Jun 08, 2013 8:07 am
Location: France
Full name: Roland Chastain
Contact:

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

Post by Roland Chastain » Sat Feb 01, 2020 9:00 am

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: 202
Joined: Wed Nov 21, 2012 11:20 pm
Location: New Hampshire

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

Post by JohnW » Sat Feb 01, 2020 1:21 pm

Dann Corbit wrote:
Sat Feb 01, 2020 4:08 am
JohnW wrote:
Fri Jan 31, 2020 11:06 pm
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: 415
Joined: Sat Jun 08, 2013 8:07 am
Location: France
Full name: Roland Chastain
Contact:

chess-image 0.2

Post by Roland Chastain » Sun Feb 02, 2020 11:39 am

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.

Post Reply