|(1) Posted by Rosie Fay [Thursday, Jul 15, 2021 15:20]|
Getting the FEN string from a diagram in this forum.
Given a diagram in a message in a topic in this forum, how do I obtain the corresponding FEN string in plain text?
You can do this in Chess Stack Exchange (https://chess.stackexchange.com/questions) because this allows any user (with enough reputation points) to edit any message -- this gives the code from which a diagram was produced, and this code includes the FEN. Not that I intend to go around editing anybody else's messages, but how do I obtain the FEN for a diagram in MAT Plus?
|(2) Posted by Dmitri Turevski [Thursday, Jul 15, 2021 16:55]|
This works in Chrome: right-click the diagram and select "Copy image address". The copied address includes something very similar to the FEN string (only position part w/o slashes, also it apparently does some aritmetics: 88 becomes 16):
Not sure if it's really useable, though.
|(3) Posted by Rosie Fay [Thursday, Jul 15, 2021 17:49]|
Thank you! That really has helped. I already have a program which takes plain text input, including FEN strings, and turns it into Tex which, with the help of Ulrike Fischer's package "chessboard", produces a PDF with lovely diagrams which I can view using SumatraPDF. My program doesn't understand MAT Plus fen, but it must be possible to do that. So, usable after a bit of work.
|(4) Posted by Hauke Reddmann [Thursday, Jul 15, 2021 20:55]|
Firefox can do the same. My suggestion, since you have to
convert it anyway: A mini python proggie which grabs the
URL*, reads its source, scans for FEN images and
converts it to standard FEN. Would cost me half an hour
maximum to write working Python code for that...
* e.g. https://www.codegrepper.com/code-examples/python/how+to+get+source+code+of+website+in+python
("requests" is no standard package and must be pip-installed!
Windows-R, execute "pip install requests")
url = "http://matplus.net/start.php?px=1626375649&app=forum&act=posts&fid=gen&tid=2722&pid=21361#n21361"
#URL example - kill the semicolon, system inserted it!
html_output_name = "out.txt"
req = requests.get(url, "html.parser")
with open(html_output_name, "w", encoding="utf-8") as f:
piccode = "src='i.php?f=" # all FEN pics start thus
with open(html_output_name, "r", encoding="utf-8") as f:
lines = f.readlines()
for line in lines:
if piccode in line:
Output - all FENs of the images in the URL
Untested if all images work this way!
|(5) Posted by Hauke Reddmann [Friday, Apr 15, 2022 10:40]|
EDIT: No, they don't - any pic generated by algebraic instead of forsyth
notation will also have its URL coded in algebraic notation.
Should be fairly simple to patch, but I'm too lazy at the moment
to write it :-)
|(6) Posted by Hannu Harkola [Friday, Apr 15, 2022 20:09]|
Helpmate Analyzer of Viktoras Paliulionis (http://helpman.komtera.lt/) has the OCR - optical character recognition feature. Upload a chessboard image or paste it from the clipboard. The resulting diagram may be corrected if necessary (very often it is). Then copy the FEN below the diagram.
|(7) Posted by Siegfried Hornecker [Saturday, Apr 16, 2022 07:42]|
The chess composer edderiofer who also is well-versed in chess problem technology has sent me this link and allowed to post it in the forum also:
(Sorry for the two notes then, Hauke! I sent them prior.)
EDIT: It does not handle fairy pieces usually, I was told.
|(8) Posted by AB H [Monday, Jun 20, 2022 12:39]|
It is possible to do a gradient on borders but it takes a little bit of trickery. For example: https://codeprozone.com/code/css/38095/css-gradient-border.html
No more posts
MatPlus.Net Forum General Getting the FEN string from a diagram in this forum.