fen2img - Creates a .png or .jpg diagram of a chess position in FEN
fen2img 'rnb1k1nr/pppp1ppp/8/4p3/3b3q/4PPP1/PPP2K1P/RNBQ1BNR b KQkq - 0 5' \
/tmp/hammerschlag.png
display /tmp/hammerschlag.png
FEN=`pgn2fen '1.f3 e5 2. Kf2 Bc5+ 3.d4 Qh4+ 4. g3 Bxd4+ 5.e3'`
fen2img -w 700 "$FEN" /tmp/t.jpg
fen2img -w 600 "$FEN" /tmp/t.png
fen2img -w 500 /tmp/t.fen /tmp/t.eps
fen2img "$FEN" - | display - # pipes a .png into display
fen2img -f "$FEN" - | display - # flip the display
This script converts a chess-position in FEN syntax into an image in
.jpg
or .png
or .eps
format.
It incorporates the same code as makes up the
chess.ps
PostScript library,
and feeds the result into gs
to convert into .jpg
or .png
format.
The board will be displayed Flipped, ie: from Black's point of view.
This option sets the Width in pixels of the .jpg
or .png
image, or the width in points of .eps
files.
Widths less than about 400 may produce
unsightly moire effects on the dark squares.
The default width is 450
Prints the Version
fen2img at is available in
git clone https://gitlab.com/peterbillam/postscriptlib
or at
https://gitlab.com/peterbillam/postscriptlib
https://gitlab.com/peterbillam/postscriptlib/tree/master/bin
http://www.pjb.com.au/comp/free/fen2img
It also needs gs to be installed, if it isn't already:
apt-get install ghostscript
or see: www.ghostscript.com/
It also needs a particular TrueType font:
http://homepages.di.fc.ul.pt/~jpn/gv/tabs/chessfont.zip
which unzips to CHEQ_TT.TTF
which you move into
/usr/share/fonts/truetype/
20180629 1.5 default width now 450 20180628 1.4 handles missing .fen file in a more user-friendly way 20180628 1.3 now works also on a t.fen file 20180627 1.2 introduce the -f Flip option 20180627 1.1 allows output on stdout, for piping into display 20180411 1.0 first working version
Peter J Billam, http://www.pjb.com.au/comp/contact.html
en.wikipedia.org/wiki/Forsyth-Edwards_Notation
www.pjb.com.au/comp/chess.html
www.pjb.com.au/