Chess Board Image API
Output Readme Download Replit Sel. & Copy Full

This repl generates JPGs of chess board positions.

Run "node script.js" to create a jpg that will be located at outputs/output.jpg The sharp library is used and you can adjust settings at the end to create a PNG, a different quality, or different size.

You will need to npm install the sharp package to make JPGs and the express and body-parser packages for makepngserver.js

You can upload different PNGs to the PNG folder to change the images for each piece or the background. If sizes don't match up exactly you may need to adjust some of the code.

You can also generate PNGs from SVGs by running "node makepngserver.js". In Replit, this should serve the makepng.html file from your repl's url. Visit the url and enter the letters for the pieces you wish to generate (RNBQKPrnbqkp to make them all), choose light or dark bg and then create. SVGs for each piece will be created then converted to a PNG that get uploaded to the server and should replace the old PNGs.

Edit the makepng.js file to change the SVG to make different PNGs and thus a new JPG outputs.

The index.html file generates a full SVG of the board and create a PNG and only depends on makepngbrowser.js.

Read this blog post about creating the chess board image API, visit to express your support for this project and signup for updates, and/or check out more of my projects at