Cropping individual counters out of counter sheets. Automated way.

What follows is a part #1 of a tutorial on automated making of counters.

Consider use case as follows:

We implement a Vassal module for recently published game. Publisher / game author was kind enough to share high-res graphics to use in the module; high-res graphics usually come in PDF format.

The task we face can be outlined as below:

1. cut the counter sheets into individual pieces and name them properly; 2. make them look good; 3. import them to Vassal.

Below is a rough-quick-and-dirty introduction as to how to deal with step #1.

Prerequisites:

1. ImageMagick 2. some experience in shell programming (batch programming in Windows).

From now on I assume use of Windows.

Say you have a counter sheet from Battle of Austerlitz by SPI (following images are used only as samples, for Vassal creation you would you original images, not scans but for educational purposes this is more than enough):





Using your favourite graphic editor you cut top stripe from the front sheet and corresponding stripe from the back sheet:

Front:



Back:



As there are 10 counters in the row, the width of stripe is divisible by 10 (1610px in my case) to ensure all the counters have same width. Counters of different width is nothing ImageMagick can't handle, of course, but for purpose of this tutorial let's assume we want them to be uniform.

Now, with your favourite text editor create a batch script containing following commands:

magick stripe-front.png -crop 10x2@ output\stripe-front-^%%02d.png magick stripe-back.png -flop -crop 10x2@ -flop output\stripe-back-^%%02d.png

Run this file. As the output you receive 2 * 2 * 10 = 40 individual files, each containing frontside or backside of a counter.