LukeShortCloud / card_games_converter

A Python program for making printable sheets of cards.
Apache License 2.0
3 stars 0 forks source link

Card Games Converter (CGC)

Build Status

This program is used to batch convert standard 2.5 by 3.5 inches playing cards into a printable format. Each card in the /tmp/cards/ directory will be rotated and have it's pixel per inch density changed to be the actual physical card size. Those card images will then be merged into stacks of 4 vertically. Next, every two stacks of 4 cards are merged horizontally to make a total of up to the maximum of 8 images per page to print. The completed images are saved to /tmp/cgc/horizontal/.

This is aimed for use with independent and free card games that are intended for personal use.

Installation

Install a modern version of Python 3. Python 3.6 and above is supported. Stable CGC releases can be manually downloaded from here. Alternatively, use pip to automatically install CGC.

$ pip install --user cgc

Usage

Printing

LibreOffice Writer Document

Insert the image to the document and ensure it is the correct size.

Insert > Image... > Open
(right click on the image) > Properties... > Width: 7" Height: 10" > OK

CLI

Help options:

cgc-cli.py --help

Python Object

Minimal Python code example:

#!/usr/bin/env python3

from cgc.cgc import CGC

cgc = CGC()
cgc.convert_batch_append_all()

Example Usage

Star Wars Trading Card Game (Wizards of the Coast)

The Star Wars Trading Card Game (TCG) lasted from 2001 to 2005 before being cancelled. It is now unofficially maintained by the Independent Development Committee (IDC) that continues to make new cards and expansion packs. The latest rulebook explaining how to play can be found here.

Download the "Zipped Card JPGs" archive of an expansion pack of playing cards from here. Extract the archive and copy the desired cards to print into a different folder. Then use CGC to process the cards.

$ cgc-cli.py --src /home/user/Documents/cards_to_print/

Printable pages of cards with the correct size and pixel density will be created and placed in the directory /tmp/cgc/horizontal/.

This utility avoids the need to use the "Printable PDFs" provided for some IDC expansions. Ink and paper are not wasted, a person can print the exact cards they want, and this addresses how not every expansion has "Printable PDFs" available.

Caching

The cache modes decreases the amount of time to re-process similar images. It was introduced in CGC 1.3.0 and is disabled by default because the cache methods could be unreliable in unknown edge case scenarios. Using cache mode requires to first run CGC at least once.

$ cgc-cli.py --cache name

Developers

Refer to the technical design document for more information about the development of CGC.

cgc_tdd.md

All of the cgc.py code should get a perfect 10/10 Pylint score.

$ pylint cgc.py
No config file found, using default configuration

------------------------------------
Your code has been rated at 10.00/10

License

Apache v2.0