Package: lcgtools
lcgtoolslcgtools includes custom card convenience tools forliving card games.lcg_pdfgenerates PDF files for printing cards, either folded prints (fold
along fold line and glue sides together) or 2-sided printing. It adds
bleed to card images and can automatically rotate images to portrait aspect.lcg_cardlistgenerates card lists forlcg_pdf. It allows feeding multiple
sets of card into one PDF generation job, including all cards in one single
PDF document and reducing paper waste.lcg_imageincludes some convenience card image transformation which includes
image rotation (to desired aspect mode), setting physical dimensions, and
adding bleed or cropping excess bleed.Licenselcgtools is released under theGNU Lesser General Public License
v3.0or later. License
details are included with the source code.Alpha softwareThe package is an alpha release and is still in development. Though we strive
to make each release functional, some things may not work as expected. As
the tools are in development, tool usage and APIs may undergo changes between
releases.InstallingThe library with source code can be installed fromPyPI. Dependencies include:PySide6Qt bindings for python (see thereferencefor more info)setuptoolsfor building from sourceThe package has been tested to work on OSX, Linux, and Windows (tested with
python fromMicrosoft StoreandAnaconda). Unfortunately, it does not (currently) work
with Windows Subsystem for Linux (WSL) due to lack of PySide6 support.lcgtools can be installed from PyPI with the commandpipinstalllcgtools# Alternatively python3 -m pip install lcgtoolsTo install lcgtools from source, run this command from the top directory
(which includes thepyproject.tomlfile),pipinstall.# alternatively "python -m pip install ."You may wish to install lcgtools withvirtualenvin order to separate the install from your general python environment.UsageSimple lcg_pdf UsageAssuming input cards include no bleed, the following command creates a pdf
with all cards in the hero_cards subdirectory.lcg_pdf--verbose--outputout.pdf--backback/player.pnghero_deck/*If the back side image includes 3 mm bleed, the command instead becomes.lcg_pdf--verbose--outputout.pdf--backback/player.png--back_bleed3hero_deck/*We could include card front images by specifying directories rather than
individual files. This is useful on Windows with its limited shell capabilities
(i.e. lack of command line wildcards). When a directory is listed, all images
in that directory are included.lcg_pdf--verbose--outputout.pdf--backback/player.png--back_bleed3hero_deck/Bleed is automatically added to output images as per defaults set in the program
or config files. We can override this with the--bleedparameter. The
following command generates output with 1 mm bleed on card front and back sides,
adding bleed (or cropping excess bleed) as necessary.lcg_pdf--verbose--outputout.pdf--bleed1--backback/player.pnghero_deck/*The default output oflcg_pdfis a PDF document with A4 page format for fold
printing, however the program also supports 2-sided printing and other
page formats. The following command generates a 2-sided US Letter document.lcg_pdf--verbose--outputout.pdf--pagesize=letter--twosided--backback/player.pnghero_deck/*Using config filesIt is possible to use a config file to override default values for many of the
command line parameters. The--gameargument is used as the filename of the
config file (followed by the.iniextension) , allowing different config
files for different card games.Additionally, some parameters can be set for individualprofiles. The profile
to apply for a configuration file is passed tolcg_pdfas a--profileargument. Currently profiles are used to set different default back side images
for different card types.If we supply a--confargument, a config file is read from the expected
location of that file. If the file is not found, the program generates an error
message which shows the path to the missing file, e.g.lcg_pdf--conf--output/tmp/dummy_argThe config file follows the basic INI file format of python'sconfigparsermodule. The
name of the config file is eitherlcg_pdf.ini(the default configuration
file), or[game].ini. The location for the config file is either~/Library/Application\ Support/lcgtools/(OSX),~/.config/lcgtools/(Linux) or%userprofile%\appdata\Local\Cloudberries\lcgtools\(Windows).Below is a config filemc.inifor a--game mcargument tolcg_pdfwhich includes profiles for "player", "encounter" and "villain" cards. Each
profile defines a default card background image which already includes 3 mm
bleed.[default]
pagesize = A4
page_dpi = 600
card_width_mm = 63.5
card_height_mm = 88
card_bleed_mm = 3

[player]
backside_image_file = ~/cards/mcg/player.png
backside_bleed_mm = 3

[encounter]
backside_image_file = ~/cards/mcg/encounter.png
backside_bleed_mm = 3

[villain]
backside_image_file = ~/cards/mcg/villain.png
backside_bleed_mm = 3With this config file, the following command will automatically apply theplayerprofile card background to the output cards PDF.lcg_pdf--verbose--conf--gamemc--outputout.pdf--profileplayerhero_deck/*lcgtools includes an example INI file which shows all configurable options with
a short description.Combining multiple card setsWhen we pass card images tolcg_pdf, all cards are generated with the same
back side. If we instead wish to create a PDF document which includes different
card types, we can do so by preparing acard listforlcg_pdfwith
the toollcg_cardlist. For the average user, it will probably be most
convenient and/or practical to write card lists to a file. Such lists can
however be written to stdout and can be chained between multiple uses of the
command, piping the final result directly intolcg_pdf.The following set of commands generate card lists for a special "hero card", a
set of "player" cards, and a set of "encounter" cards. We use the--confmechanism to use defined default back sides of cards as described above. Note
the use of the--appendoption when adding cards to an already existing list.lcg_cardlist--verbose--conf--gamemc--outputCARDS.TXT--backhero_card/back.pnghero_card/front.png
lcg_cardlist--verbose--conf--gamemc--outputCARDS.TXT--append--profileplayerhero_deck/*
lcg_cardlist--verbose--conf--gamemc--outputCARDS.TXT--append--profileencounternemesis/*The generated cards list can be used as an input tolcg_pdf, which loads the
appropriate back side images and applies the relevant card bleed information
defined for each card set, e.g.lcg_pdf--verbose--conf--gamemc--outputout.pdf--listCARDS.TXTSimple image conversionsThe toollcg_imagesupports some image transformation which can be useful when
working with custom cards. It takes some of the transformations that were
developed forlcg_pdfand enables applying them to single images or sets of
images. This could be useful for working together with other card printing
tools, e.g. usinglcg_imageto rotate cards to portrait mode before feeding
them to another PDF generation program. The following example sets the
physical size of an image, adds 5 mm bleed, and rotates images with a landscape
aspect to a portrait aspect.lcg_image--outputconverted.png--to_portrait--resize--width63.5--height88--bleed5player.pngThe following command will perform the same transformation on each specified
input image, writing results to images withconverted_as an added filename
prefix.lcg_image--prefixconverted_--to_portrait--resize--width63.5--height88--bleed5*.pngOther informationWhen printing PDF documents generated withlcg_pdf, make sure to set up
printing so that itprints to actual sizefor the document. Many PDF viewers
are set up by default to print documents scaled to print all content, including
page margins. This leads to cards being scaled to a smaller size than their
intended specified physical size.What to expect going forwardTo discuss where we are going with this tool, I'll make a couple comments about
where it started. It all began with some friends introducing me toMarvel Champions: The Card Game. One thing led
to the other, and a couple months later I am the proud owner of pretty much all
the cards which have been released, having fun getting into the game. During my
various browsing I came across the wonderful world of custom game content;
a Google Search for "marvel champions custom" will take you to theHall of Heroesweb site, and
eventually you end up on the Marvel Champions LCG Homebrewdiscordwith nice people and lots of
custom content.As I played around with how to print sets, I ended up wanting to make my own
thing because "why not" and "putting stuff on PDFs from scripts can't be that
hard, can it?", and then I could make the tool the way I wanted to, plus
I wanted it to be multi platform.I started out with a dirty hard-coded hack, improved it a bit, added a command
line interface, tried to modify it so that others might be able to use it and
understand how it works, made it packageable for PyPI, etc. What started out as
an "evening hack" turned out to be a bit more work. However, this unfortunately
means I don't currently get toplaythe game as I am too busy developing this
thing. So now that the tool seems to be in a reasonable shape as an initial
release that I can share it without hopefully being too embarrassed, I
want to get it published so I can get back to playing the game andusingthe
tool.With regards to the future; this is not my day job, it is a small side
project in the midst of a very busy family life with small kids, plus I am not
a developer by trade, so you should probably not expect an active maintainer who
immediately jumps on every issue. That being said, I do hate it when stuff does
not work as intended, so I'll probably want to try to sort things out if there
are issues.