<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming Archives - AI Art Blog</title>
	<atom:link href="https://aiartblog.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>News, Articles, Howtos related to AI Art and Generative AI</description>
	<lastBuildDate>Sun, 21 Dec 2025 17:07:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>

<image>
	<url>https://aiartblog.com/wp-content/uploads/2023/12/favico-1.png</url>
	<title>Programming Archives - AI Art Blog</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Creating cards for board game with ImageMagick and Python</title>
		<link>https://aiartblog.com/ai-image/creating-cards-for-board-game-with-imagemagick-and-python/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-cards-for-board-game-with-imagemagick-and-python</link>
					<comments>https://aiartblog.com/ai-image/creating-cards-for-board-game-with-imagemagick-and-python/#comments</comments>
		
		<dc:creator><![CDATA[aiartblog]]></dc:creator>
		<pubDate>Wed, 07 May 2025 19:44:37 +0000</pubDate>
				<category><![CDATA[ai image]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[BoardGame]]></category>
		<category><![CDATA[CardGame]]></category>
		<category><![CDATA[ChatGPT]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[scripting]]></category>
		<guid isPermaLink="false">https://aiartblog.com/?p=751</guid>

					<description><![CDATA[<p>Introduction Why is it hard to create cards manually (one-by-one) and what can be the solution for this? In board game design there are some time consuming processes like the creation of the cards. Did you now that this process can be automated? If you have a table or CSV file with the cards data...</p>
<p>The post <a href="https://aiartblog.com/ai-image/creating-cards-for-board-game-with-imagemagick-and-python/">Creating cards for board game with ImageMagick and Python</a> appeared first on <a href="https://aiartblog.com">AI Art Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph"><strong>Why is it hard to create cards manually (one-by-one) and what can be the solution for this?</strong></p>



<p class="wp-block-paragraph">In board game design there are some time consuming processes like the creation of the cards. Did you now that this process can be automated? If you have a table or <a href="https://en.wikipedia.org/wiki/Comma-separated_values">CSV file</a> with the cards data (eg. Title, serial number, neccessary icons, images) and some basic images, then ImageMagick and Python can help you to create the cards. Imagine if you have 100 or more cards with different text on it and you decide to change the font or the background color. Instead of doing this manually for all 100 cards you can simply edit and run a Python script to update your cards.</p>



<p class="wp-block-paragraph">In this article we will use the powerful and free ImageMagick tool which has a lot of image editing functions. <a href="https://usage.imagemagick.org/">Just check this site for examples</a>, but avoid to deep dive into the documentation at this moment.</p>



<p class="wp-block-paragraph"><br>First, we write a <strong>Python script</strong> with the help of chatGPT.</p>



<p class="wp-block-paragraph">Then we <strong>run </strong>the script and <strong>check </strong>the result.</p>



<p class="wp-block-paragraph">Finally I give you a brief explanation of the <strong>most important parameters</strong> to understand which ones you need to edit to reach the expected result.</p>



<p class="wp-block-paragraph">I will guide you through the whole process <strong>step-by-step</strong>.</p>



<p class="wp-block-paragraph">It is good if you have some basic programming experience, but it is not a requirement to follow this tutorial.</p>



<p class="wp-block-paragraph">If you are not familiar with programming or scripting or you just search for <strong>a more user friendly method</strong>, then jump to the end of this guide where I give you alternate ways to create the cards.</p>



<h2 class="wp-block-heading">Tools we will use</h2>



<ul class="wp-block-list">
<li>ImageMagick,</li>



<li>Python,</li>



<li>chatGPT,</li>



<li>Notepad++ (or other IDE)</li>



<li>Google sheets or a CSV file</li>
</ul>



<h2 class="wp-block-heading">Steps before building and running the script</h2>



<h3 class="wp-block-heading">Installing Python</h3>



<p class="wp-block-paragraph">Go to <a href="https://www.python.org/downloads/">python.org and download the latest version</a>. Follow the steps of the installation wizard. Before selecting <strong>Install Now </strong>turn on “<strong>Add python.exe to PATH</strong>”.<br>This option gives you the ability to run Python scripts in any folder on your computer.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="676" height="425" src="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_python_install.jpg" alt="" class="wp-image-757" srcset="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_python_install.jpg 676w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_python_install-300x189.jpg 300w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_python_install-150x95.jpg 150w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_python_install-400x250.jpg 400w" sizes="(max-width: 676px) 100vw, 676px" /></figure>
</div>


<p class="has-text-align-center wp-block-paragraph">Make sure to check “Add python.exe to PATH”</p>



<h3 class="wp-block-heading">Installing ImageMagick</h3>



<p class="wp-block-paragraph">Go to the <a href="https://imagemagick.org/">ImageMagick</a> website and select the appropriate version of the software.<br>I use Windows, so <a href="https://imagemagick.org/script/download.php#windows">I downloaded and installed the Windows version</a>.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="581" height="481" src="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_imagemagick_install.jpg" alt="" class="wp-image-755" srcset="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_imagemagick_install.jpg 581w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_imagemagick_install-300x248.jpg 300w" sizes="(max-width: 581px) 100vw, 581px" /></figure>
</div>


<p class="has-text-align-center wp-block-paragraph">Make sure to check the “<strong>Add application directory to your system path</strong>” option</p>



<h3 class="wp-block-heading">Installing a text editor, like Notepad++</h3>



<p class="wp-block-paragraph">I recommend to use Notepad++, because it has many useful features, like syntax highlighting. Go to the <a href="https://notepad-plus-plus.org/downloads/">Notepad++ download page</a> and install it.</p>



<p class="wp-block-paragraph"><strong>Remark:</strong> You can use any other text editor or IDE. The simplest text editor in Windows is Notepad, but it don’t have the syntax highlighting feature. Another popular and powerful IDE (Integrated Development Environment) is <strong><a href="https://code.visualstudio.com/">Visual Studio Code</a></strong> (shortly: vscode).</p>



<h2 class="wp-block-heading">Creating the project folder</h2>



<p class="wp-block-paragraph">Use any file management tool (or command line) to create a project folder with any name you like. I created the <strong>create_cards</strong> folder for this example project.</p>



<p class="wp-block-paragraph">Create a subfolder with the name <strong>images </strong>in the project folder. We will put our basic images into this folder.</p>



<p class="wp-block-paragraph">Create the <strong>icons </strong>subfolder in the project folder and place the text bubble icon into this folder.</p>



<p class="wp-block-paragraph">After the project folder and the cards subfolder are created move on to the next step.</p>



<p class="wp-block-paragraph">This is the folder structure after all necessary folders are created:</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" width="201" height="77" src="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_folder_structure.jpg" alt="" class="wp-image-760" style="width:201px"/></figure>



<p class="wp-block-paragraph"><strong>Remark:</strong> The output folder will be created by the Python script.</p>



<h2 class="wp-block-heading">Create or download the starting images</h2>



<p class="wp-block-paragraph">We need to put the starting card images into the cards folder and the message.png icon into the icons folder.</p>



<p class="wp-block-paragraph">You can <a href="/wp-content/downloads/create_cards_starting_images.zip">download them in one .zip file</a> or one-by-one below.</p>



<figure class="wp-block-gallery has-nested-images columns-4 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="512" height="512" data-id="776" src="https://aiartblog.com/wp-content/uploads/2025/05/goblin.png" alt="" class="wp-image-776" srcset="https://aiartblog.com/wp-content/uploads/2025/05/goblin.png 512w, https://aiartblog.com/wp-content/uploads/2025/05/goblin-300x300.png 300w, https://aiartblog.com/wp-content/uploads/2025/05/goblin-150x150.png 150w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="512" height="512" data-id="775" src="https://aiartblog.com/wp-content/uploads/2025/05/elf.png" alt="" class="wp-image-775" srcset="https://aiartblog.com/wp-content/uploads/2025/05/elf.png 512w, https://aiartblog.com/wp-content/uploads/2025/05/elf-300x300.png 300w, https://aiartblog.com/wp-content/uploads/2025/05/elf-150x150.png 150w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="512" height="512" data-id="774" src="https://aiartblog.com/wp-content/uploads/2025/05/titan.png" alt="" class="wp-image-774" srcset="https://aiartblog.com/wp-content/uploads/2025/05/titan.png 512w, https://aiartblog.com/wp-content/uploads/2025/05/titan-300x300.png 300w, https://aiartblog.com/wp-content/uploads/2025/05/titan-150x150.png 150w" sizes="auto, (max-width: 512px) 100vw, 512px" /></figure>



<figure class="wp-block-image size-medium"><img loading="lazy" decoding="async" width="300" height="300" data-id="773" src="https://aiartblog.com/wp-content/uploads/2025/05/spartan-300x300.png?wsr" alt="" class="wp-image-773" srcset="https://aiartblog.com/wp-content/uploads/2025/05/spartan-300x300.png 300w, https://aiartblog.com/wp-content/uploads/2025/05/spartan-150x150.png 150w, https://aiartblog.com/wp-content/uploads/2025/05/spartan.png 512w" sizes="auto, (max-width: 300px) 100vw, 300px" /></figure>
</figure>



<p class="wp-block-paragraph">message64.png:</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="64" height="64" src="https://aiartblog.com/wp-content/uploads/2025/05/message64.png" alt="" class="wp-image-779" style="width:64px"/></figure>



<p class="wp-block-paragraph">message64.png (white background at the text bubble)</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="64" height="64" src="https://aiartblog.com/wp-content/uploads/2025/05/message64-1.png" alt="" class="wp-image-806" style="width:64px"/></figure>



<h2 class="wp-block-heading">Generating the first script</h2>



<p class="wp-block-paragraph">I use chatGPT to generate the Python code.</p>



<p class="wp-block-paragraph">This is the <strong>prompt to generate the script</strong> (feel free to use other prompt to customize the script for your current project):</p>



<p class="wp-block-paragraph"><em>Help creating a Python script which uses ImageMagick to create cards for a fantasy themed card&nbsp;game. The card with is 45mm and the height is 68mm. The resolution is 150dpi. Use a CSV file as a data source for the cards. The CSV file contains the title, serial number, icon and base image. Place the title in the upper center part of the card in yellowish gold color on darkgreen background. Place the serial number in the upper left corner with black text and use an orange circle with black border as background. If the third column (icon) in the CSV file is True, then place the message64.png icon from the icons folder into the lower left corner on the card. Place the base image in the center of the card. Use darkblue background for the card. The base images are in the images folder. Save the cards into the cards_output folder. Be aware of how ImageMagick works: &#8220;Image Composition is the process of merging two (and only two) images in a variety of ways.&#8221;</em></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">So my prompt contains the following parameters:</p>



<ul class="wp-block-list">
<li>Using a CSV file</li>



<li>Card size in millimeters</li>



<li>Print resolution in DPI (I use 150dpi for faster process and testing)</li>



<li>Using some images without any text and number (center align)</li>



<li>Card title (top align)</li>



<li>Card serial number in an orange circle</li>



<li>Message icon &#8211; if needed on a specific card</li>
</ul>



<p class="wp-block-paragraph"><strong>Tip:</strong> Be as concrete as you can when you formulate your prompt. Then the result will we more close to your wishes.</p>



<h2 class="wp-block-heading">Script and CSV file what I got</h2>



<p class="wp-block-paragraph">Here you can see the script (double click on the code to select all):</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
import csv
import os
import subprocess
import tempfile
import shutil

# Constants
WIDTH_MM = 45
HEIGHT_MM = 68
DPI = 150
WIDTH_PX = int(WIDTH_MM / 25.4 * DPI)
HEIGHT_PX = int(HEIGHT_MM / 25.4 * DPI)

OUTPUT_DIR = &quot;cards_output&quot;
IMAGES_DIR = &quot;images&quot;
ICONS_DIR = &quot;icons&quot;

os.makedirs(OUTPUT_DIR, exist_ok=True)

def run_magick(args):
    subprocess.run(&#x5B;&quot;magick&quot;] + args, check=True)

def generate_temp_image(filename, args):
    temp_path = os.path.join(tempfile.gettempdir(), filename)
    run_magick(args + &#x5B;temp_path])
    return temp_path

def create_card(title, serial, icon, base_image_filename):
    base_image_path = os.path.join(IMAGES_DIR, base_image_filename)
    icon_path = os.path.join(ICONS_DIR, &quot;message64.png&quot;)
    output_path = os.path.join(OUTPUT_DIR, f&quot;{serial}.png&quot;)

    temp_files = &#x5B;]

    try:
        # 1. Base background (dark blue)
        base_bg = generate_temp_image(f&quot;{serial}_bg.png&quot;, &#x5B;
            &quot;-size&quot;, f&quot;{WIDTH_PX}x{HEIGHT_PX}&quot;, &quot;xc:#001a4d&quot;
        ])
        temp_files.append(base_bg)

        # 2. Title bar with text
        title_img = generate_temp_image(f&quot;{serial}_title.png&quot;, &#x5B;
            &quot;-size&quot;, f&quot;{WIDTH_PX}x40&quot;, &quot;xc:#004d00&quot;,
            &quot;-gravity&quot;, &quot;center&quot;, &quot;-pointsize&quot;, &quot;20&quot;, &quot;-fill&quot;, &quot;#FFD700&quot;,
            &quot;-annotate&quot;, &quot;+0+5&quot;, title
        ])
        temp_files.append(title_img)

        composed1 = generate_temp_image(f&quot;{serial}_step1.png&quot;, &#x5B;
            base_bg, title_img, &quot;-gravity&quot;, &quot;north&quot;, &quot;-composite&quot;
        ])
        temp_files.append(composed1)

        # 3. Serial number circle
        serial_circle = generate_temp_image(f&quot;{serial}_serial.png&quot;, &#x5B;
            &quot;-size&quot;, &quot;100x100&quot;, &quot;xc:none&quot;,
            &quot;-fill&quot;, &quot;orange&quot;, &quot;-stroke&quot;, &quot;black&quot;, &quot;-strokewidth&quot;, &quot;4&quot;,
            &quot;-draw&quot;, &quot;circle 20,20 50,0&quot;,
            &quot;-gravity&quot;, &quot;northwest&quot;, &quot;-extent&quot;, f&quot;{WIDTH_PX}x{HEIGHT_PX}&quot;,
            &quot;-gravity&quot;, &quot;northwest&quot;, &quot;-pointsize&quot;, &quot;20&quot;, &quot;-fill&quot;, &quot;black&quot;,
            &quot;-annotate&quot;, &quot;+25+30&quot;, serial
        ])
        temp_files.append(serial_circle)

        composed2 = generate_temp_image(f&quot;{serial}_step2.png&quot;, &#x5B;
            composed1, serial_circle, &quot;-gravity&quot;, &quot;northwest&quot;, &quot;-composite&quot;
        ])
        temp_files.append(composed2)

        # 4. Center image (base image)
        resized_base = generate_temp_image(f&quot;{serial}_baseimg.png&quot;, &#x5B;
            base_image_path, &quot;-resize&quot;, f&quot;{int(WIDTH_PX*0.8)}x{int(HEIGHT_PX*0.5)}&quot;
        ])
        temp_files.append(resized_base)

        centered_base = generate_temp_image(f&quot;{serial}_basecenter.png&quot;, &#x5B;
            &quot;-size&quot;, f&quot;{WIDTH_PX}x{HEIGHT_PX}&quot;, &quot;xc:none&quot;,
            resized_base, &quot;-gravity&quot;, &quot;center&quot;, &quot;-composite&quot;
        ])
        temp_files.append(centered_base)

        composed3 = generate_temp_image(f&quot;{serial}_step3.png&quot;, &#x5B;
            composed2, centered_base, &quot;-gravity&quot;, &quot;center&quot;, &quot;-composite&quot;
        ])
        temp_files.append(composed3)

        # 5. Optional icon in lower left
        if icon.lower() == &quot;true&quot;:
            resized_icon = generate_temp_image(f&quot;{serial}_icon.png&quot;, &#x5B;
                icon_path, &quot;-resize&quot;, &quot;40x40&quot;
            ])
            temp_files.append(resized_icon)

            icon_layer = generate_temp_image(f&quot;{serial}_iconlayer.png&quot;, &#x5B;
                &quot;-size&quot;, f&quot;{WIDTH_PX}x{HEIGHT_PX}&quot;, &quot;xc:none&quot;,
                resized_icon, &quot;-gravity&quot;, &quot;southwest&quot;, &quot;-geometry&quot;, &quot;+10+10&quot;, &quot;-composite&quot;
            ])
            temp_files.append(icon_layer)

            composed4 = generate_temp_image(f&quot;{serial}_step4.png&quot;, &#x5B;
                composed3, icon_layer, &quot;-gravity&quot;, &quot;southwest&quot;, &quot;-composite&quot;
            ])
            temp_files.append(composed4)

            shutil.copy(composed4, output_path)
        else:
            shutil.copy(composed3, output_path)

        print(f&quot;Card created: {output_path}&quot;)

    finally:
        # Clean up temp files
        for file in temp_files:
            try:
                os.remove(file)
            except FileNotFoundError:
                pass

# Read CSV
with open(&quot;cards.csv&quot;, newline=&#039;&#039;, encoding=&#039;utf-8&#039;) as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        create_card(
            title=row&#x5B;&quot;title&quot;],
            serial=row&#x5B;&quot;serial&quot;],
            icon=row&#x5B;&quot;icon&quot;],
            base_image_filename=row&#x5B;&quot;base_image&quot;]
        )

</pre></div>


<p class="wp-block-paragraph">Here is the csv file:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
title,serial,icon,base_image
Spartan Soldier,01,True,spartan.png
Titan Warrior,02,False,titan.png
Elf Wizard,03,True,elf.png
Dark Goblin,04,False,goblin.png

</pre></div>


<h2 class="wp-block-heading">Saving and running the script</h2>



<p class="wp-block-paragraph">chatGPT generated the Python script and a sample .csv file (see above).</p>



<p class="wp-block-paragraph">Create a new Python file in your project folder, copy-paste the script and save it.<br><strong>Remark: </strong>you can create a new file in Notepad++, paste the Python script and save as <strong>create_cards.py</strong> file.</p>



<p class="wp-block-paragraph">Create a new CSV file and copy-paste the sample CSV file content from chatGPT or the code above. Save the file as <strong>cards.csv</strong>.</p>



<p class="wp-block-paragraph">Run the script simply by double clicking on the filename.</p>



<p class="wp-block-paragraph">If there are no errors, then the script runs and saves the card images into the <strong>cards_output</strong> folder. Check the folder for the results.</p>



<p class="wp-block-paragraph">If there are errors in the Python script, then you should fix them to run the image export. See the Troubleshooting chapter to learn how to fix errors.</p>



<p class="wp-block-paragraph"><strong>Tip:</strong> if you would like to see what Python writes on the screen, then do one of the following:</p>



<ol style="list-style-type:upper-alpha" class="wp-block-list">
<li>run the script in command line. To do this open the command line by hitting the Windows button and type cmd, then hit ENTER. Navigate to the folder of the script (use cd foldername) and type the Python program name to run it.</li>



<li>Insert the following line of code after the last line in the script in a new line and save the file:<br>input(&#8220;Press ENTER to exit the program!&#8221;)</li>
</ol>



<h2 class="wp-block-heading">Editing the script</h2>



<p class="wp-block-paragraph">Right click on the .py file and select “Edit with NotePad++”. Be sure to save the file after editing.</p>



<h2 class="wp-block-heading">Troubleshooting the script</h2>



<p class="wp-block-paragraph">Python prints error messages on the screen if the script contains errors. I help you fix these errors in this chapter.</p>



<h3 class="wp-block-heading">&#8220;No such file or directory&#8221; error</h3>



<p class="wp-block-paragraph">magick: unable to open image &#8216;images\spartan.png&#8217;: No such file or directory @ error/blob.c/OpenBlob/3596.</p>



<p class="wp-block-paragraph"><strong>Solution:</strong></p>



<ul class="wp-block-list">
<li>copy the images to the correct folder</li>



<li>rename the images if the names are incorrect</li>
</ul>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">Fine-tuning the results</h2>



<h3 class="wp-block-heading">Fixing object size, transparency settings and alignment</h3>



<p class="wp-block-paragraph">I made several fixing steps. <br>To fix transparency I replaced row 60 with this line:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
        &quot;-gravity&quot;, &quot;northwest&quot;, &quot;-background&quot;, &quot;none&quot;, &quot;-extent&quot;, f&quot;{WIDTH_PX}x{HEIGHT_PX}&quot;,
</pre></div>


<p class="wp-block-paragraph">These are the thumbnails of the test images:</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6acab5dad3c6c&quot;}" data-wp-interactive="core/image" data-wp-key="6acab5dad3c6c" class="wp-block-image size-large wp-lightbox-container"><img loading="lazy" decoding="async" width="1024" height="209" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images-1024x209.jpg" alt="" class="wp-image-798" srcset="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images-1024x209.jpg 1024w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images-300x61.jpg 300w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images-768x157.jpg 768w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images.jpg 1280w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">More tweaking needed:</p>



<ul class="wp-block-list">
<li>decrease the radius of the orange circle</li>



<li>decrease the border of it</li>



<li>fix the background of the message64.png icon (you can download the fixed version above)</li>
</ul>



<p class="wp-block-paragraph">These are the thumbnails of the refined images:</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="559" height="566" src="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images2.jpg?wsr" alt="" class="wp-image-808" style="width:559px" srcset="https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images2.jpg 559w, https://aiartblog.com/wp-content/uploads/2025/05/creating_cards_for_board_game_final_images2-296x300.jpg 296w" sizes="auto, (max-width: 559px) 100vw, 559px" /></figure>



<p class="wp-block-paragraph"><br>You can <a href="/wp-content/downloads/create_cards_3.py" target="_blank" rel="noreferrer noopener">download the refined Python script from this link</a>.</p>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading">Changing text color</h3>



<p class="wp-block-paragraph">I checked the exported images and I see, that the text is too bright so I change the code:</p>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color wp-elements-5 wp-block-paragraph">Sorry, this chapter is just a draft. Update coming soon…</p>



<h3 class="wp-block-heading">Different aspect ratio</h3>



<p class="wp-block-paragraph">If you would like to create 1:1 aspect ratio images, then simply write the same number for width and height (row 8 and 9 in the Python script, CARD_WIDTH_MM and CARD_HEIGHT_MM).</p>



<h3 class="wp-block-heading">Using Google fonts</h3>



<p class="wp-block-paragraph">You can easily change the font by replacing the approriate line:</p>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color wp-elements-6 wp-block-paragraph">Sorry, this chapter is just a draft. Update coming soon…</p>



<p class="wp-block-paragraph">I selected the Fancy Feeling on <a href="https://fonts.google.com/?categoryFilters=Feeling:%2FExpressive%2FFancy">fonts.google.com</a> and browsed through the fonts. My final decision was the <a href="https://fonts.google.com/specimen/Birthstone/license?categoryFilters=Feeling:%2FExpressive%2FFancy">Birthstone font</a>.</p>



<p class="wp-block-paragraph">Always read the license of the fonts to learn about the usage of them.</p>



<h2 class="wp-block-heading">Creating exact number of some type of cards</h2>



<p class="wp-block-paragraph">Sometimes we need to create almost the same cards but with different text, icons and numbers.</p>



<p class="wp-block-paragraph">Imagine that we would like to create a deck of 30 cards. 10 cards with a dragon, 10 cards with a knight, 5 cards with dwarfs, 5 cards with a sword.</p>



<p class="wp-block-paragraph">Then instead of using different images for every card, we shoud include another column in the table or in the CSV file, which indicates which image we need on which card.</p>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color wp-elements-7 wp-block-paragraph">Sorry, this content is just a draft. Update coming soon…</p>



<h2 class="wp-block-heading">Prepare the cards for print</h2>



<p class="wp-block-paragraph">Now we have separate cards with nice text and icons. The next step is to print them. Use the following script to align more then one card on a page with. I use A4 paper size, but you can use any other standard. A4 paper dimensions: 210x297mm.</p>



<p class="has-vivid-cyan-blue-color has-text-color has-link-color wp-elements-8 wp-block-paragraph">Sorry, this chapter is just a draft. Update coming soon…</p>



<h2 class="wp-block-heading">Alternative ways to create cards for board games</h2>



<p class="wp-block-paragraph">If you don’t like scripting and you would like to do this job with a more user friendly way, than you can use one of this tools:</p>



<ul class="wp-block-list">
<li><a href="https://nandeck.com/" target="_blank" rel="noreferrer noopener">Nandeck</a></li>



<li><a href="https://www.dextrous.com.au/">Dextrous</a></li>



<li><a href="https://forgeofcards.com/" target="_blank" rel="noreferrer noopener">Forge of Cards</a></li>



<li><a href="https://tabletop-creator.com" target="_blank" rel="noreferrer noopener">Tabletop Creator</a></li>
</ul>



<p class="wp-block-paragraph">Dextrous is very user friendly, you see the end result immediately and it can use .CSV files as data source for card data. The free version can be enough for most of the use cases.</p>



<p class="wp-block-paragraph">The list is not complete and I may update it later.</p>



<h2 class="wp-block-heading">Final words</h2>



<p class="wp-block-paragraph">I hope you enjoyed this guide and found it useful. Happy card designing! If you have any questions feel free to ask them in the chat below!</p>



<p class="wp-block-paragraph">Thanks for reading this long article! 🙂</p>
<p>The post <a href="https://aiartblog.com/ai-image/creating-cards-for-board-game-with-imagemagick-and-python/">Creating cards for board game with ImageMagick and Python</a> appeared first on <a href="https://aiartblog.com">AI Art Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://aiartblog.com/ai-image/creating-cards-for-board-game-with-imagemagick-and-python/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
