hello! here's a little about me:
inspired by natemoo-re
luckily being good at chess wasn't a pre-req to the job
Accepts FEN, PGN or array data for chess board and generates PNG or buffer.
Home Page: https://www.npmjs.com/package/chess-image-generator
License: MIT License
hello! here's a little about me:
inspired by natemoo-re
luckily being good at chess wasn't a pre-req to the job
npm i -S chess-image-generator
fails with numerous errors (see log below) on my Debian Linux system. Can someone fluent with linux command line Javascript point me in the right direction? Thanks.
https://drive.google.com/file/d/11Fad6mYA3hfT9Bvr9PVHvfZXjuaftpYP/view?usp=sharing
Hey everybody and hey @andyruwruw !
Thanks for creating this beautiful library, got it integrated in whatsapp-chess. I would love to add col and row descriptions (ABCDEFGH and 12345678).
We could either achieve this by coding it right into, or by letting the user get the svg itself so he could then manipulate it.
Would love to do this and will open a pr right away!
Hope you will merge it if it suits your roadmap and release it asap.
Hi, this is a very useful lib, thank you. I was planning to use it for my project, but unfortunately pieces are blurred, as the ones used as a demonstration in the README.
Looking at the source, it seems logical since images are loaded, and then scaled. I think it would be better to generate a vector image instead, and then scale it, and convert it to PNG, to preserve image quality.
I could not find a way to do this with Canvas (using Canvas in a non-web NodeJS env is a little hackish), so I cannot PR something, and ended up making my own script. I thought it would interest you so I made a gift with a simplified version (using Merida style) that generates a SVG file, that next could be easily converted to a high quality PNG file :
https://gist.github.com/loicmarie/6426394790fb0155225fa4994f89cbdf
Hey,
In the readme file, you need to chnage this:
var ChessImageGenerator = require('chess-web-api');
To
var ChessImageGenerator = require('chess-image-generator');
Thanks :)
import ChessImageGenerator from "chess-image-generator";
const FEN = "r2qk2r/p1p5/bpnbp2p/1N1p1p2/P2P1p1N/2PQ2P1/1P2PPBP/R4RK1 b kq - 1 13";
const SIZE = "1024";
const LIGHT_COLOR = "#efefef";
const DARK_COLOR = "#8777b7";
(async () => {
let imageGenerator = new ChessImageGenerator({
size: SIZE,
light: LIGHT_COLOR,
dark: DARK_COLOR,
style: "merida"
});
await imageGenerator.loadFEN(FEN);
await imageGenerator.generatePNG("example.png");
})();
This should output an image.
It fails with this error:
/Users/landon/Development/personal/chess-flashcards/node_modules/chess-image-generator/src/chess-image-generator.js:172
fs.write(fd, buffer, 0, buffer.length, null, (writeError) => {
^
TypeError: Cannot read property 'length' of undefined
at /Users/landon/Development/personal/chess-flashcards/node_modules/chess-image-generator/src/chess-image-generator.js:172:38
at FSReqCallback.oncomplete (fs.js:163:23)
It looks like the generateBuffer
function always returns undefind
because frame.toBuffer()
returns undefined
.
latest
You should add an option to specify if the board should be seen from white or black's perspective.
DELETE THIS PLEASE.
There have been some issues with blurring scaling the chess pieces to the PNG size.
Goal should be to offer a SVG option and clean up the PNG as best as possible.
Dear Andy,
Does your program support chinese chess?
Best regards,
sandy
As the title suggests, after using the generatePNG function, the image outputted presents weird artefacts near the pieces.
const ChessImageGenerator = new require('chess-image-generator');
const imageGenerator = new ChessImageGenerator({
size:640
});
imageGenerator.loadFEN('r2qk2r/p1p5/bpnbp2p/1N1p1p2/P2P1p1N/2PQ2P1/1P2PPBP/R4RK1 b kq - 1 13')
.then((data)=>{
console.log("SUCCESS");
}, logError);
imageGenerator.generatePNG('./testgame2.png');
latest
await generator.highlightSquares(["c8", "b7"])
It should highlight that squares
Showing error:
TypeError: generator.highlightSquares is not a function
Drop this lib
it will work much faster
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.