Code Monkey home page Code Monkey logo

chess-pgn-gif's Introduction

Chess PGN to Gif

Purpose: Convert a chess game given in PGN format to a GIF file using some intermediate python libraries. This made for a fun afternoon project on which I can keep iterating and learn new things. It also showcases the power of Python as a glue language!

Dedicated to my father a.k.a "baba" from whom I learned the basics of chess :)

Dependencies

The scripts have fairly minimal setup requirements. The project was last tested with the following packages on Ubuntu 20.04. Note: not tested with other operating systems!

See the requirements.txt to test the code out and environment.yml for setting up a dev environment to hack the code.

Usage

chess_gif.py is the main python file to use for creating the gif. Use as:

$ python chess_gif.py -d DURATION -i INPUT -o OUTPUT

  • DURATION: time given to each frame in the output gif.
  • INPUT: path for .pgn file for the chess game.
  • OUTPUT desired path for output .gif.

The board and its moves are represented as an 'ASCII art' image. text_to_img.py is an intermediate helper script to create image representation of a text file.

To Do

No guarantees as to when I'll actually sit down

  • Cleanup the repo, update readme, requirements and todo.
  • Make the images.append() warning from imageio disappear by updating the code
  • Can we avoid writing tmp files and images and instead keep everything in memory?
  • Write code for proper unit tests. For now, tests/ just contains not so pretty jupyter notebooks left over from >4 years ago!
  • SVG output files for images.
  • Custom images for the board pieces instead of letters (i.e more pretty output!)
  • Other output formats: interactive webpage using javascript where one can move forward or backward with the moves.
    • Custom options for the output like resolution, quality, etc...
  • Host a web frontend where user will upload .pgn file and you produce required output with option to save it?

chess-pgn-gif's People

Contributors

kninad avatar

Stargazers

 avatar

Watchers

 avatar  avatar

chess-pgn-gif's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.