Last active
May 7, 2026 23:06
-
-
Save hariedo/57ed2533726c90c4ef3217adddf307ed to your computer and use it in GitHub Desktop.
Walk a CSV to generate a series of placeholder PNG files of various sizes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # | |
| # take a CSV of template image sizes, and make template image placeholders | |
| # using the ImageMagick command line for each entry in the table | |
| # | |
| import subprocess | |
| import csv | |
| import os | |
| def qx(cmd, verbose=False): | |
| '''Just like qx// or backticks operator from Perl, running the command | |
| and returning the STDOUT results as a string. Optional echo of the | |
| command issued first. | |
| ''' | |
| if verbose: print(cmd) | |
| run = subprocess.Popen(cmd, #shell=True, | |
| stdout=subprocess.PIPE, | |
| stderr=subprocess.PIPE) | |
| (out, err) = run.communicate() | |
| if run.returncode != 0: | |
| return 'Return code: %d' % run.returncode | |
| return out | |
| if __name__ == '__main__': | |
| folder = './templates' | |
| magick = 'magick' | |
| #magick = 'convert' | |
| requests = 'templates.txt' | |
| font = 'Arial' | |
| #font = 'Ubuntu-Sans' | |
| if not os.path.exists(folder): | |
| os.mkdir(folder) | |
| line = 0 | |
| with open(requests) as f: | |
| data = csv.reader(f) | |
| for row in data: | |
| line += 1 | |
| if not len(row): | |
| continue | |
| if row[0].startswith('#'): | |
| continue | |
| # x, y, name, description | |
| row = [ cell.strip() for cell in row ] | |
| (x, y) = (int(row[0]), int(row[1])) | |
| name = row[2] | |
| output = qx( [ | |
| magick, | |
| '-size', f'{x}x{y}', 'xc:black', | |
| '-font', font, '-pointsize', '24', '-fill', '#c0c0c0', | |
| '-gravity', 'northwest', | |
| '-annotate', '+10+10', | |
| f' {x}x{y} {name}', | |
| os.path.join(folder, f'{name}.png'), | |
| ], True) | |
| print(output) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Steamworks Store Assets | |
| # store page assets | |
| 460, 215, store_capsule_header, just game logo and artwork | |
| 616, 353, store_capsule_main, just game logo and artwork | |
| 231, 87, store_capsule_small, just game logo and artwork | |
| 374, 448, store_capsule_vertical, just game logo and artwork | |
| 1438, 810, store_page_background, subtle artwork, not too bright | |
| # library assets | |
| 600, 900, library_capsule, just game logo and artwork | |
| 3840,1240, library_hero, just game artwork, no logo | |
| 1280, 720, library_logo, just logo with transparent background | |
| # community assets | |
| 184, 184, community_icon, small logo or icon | |
| 32, 32, client_icon, .ico format multi-size 32x32 min | |
| # event assets | |
| 800, 450, event_cover, artwork and marketing copy for announcement | |
| 1920, 622, event_header, special safe zone bleed/cropping rules | |
| # bundle assets (optional) | |
| # achievement assets | |
| 256, 256, ach_awarded, artwork for an awarded achievement (colorful) | |
| 256, 256, ach_unawarded, art for a locked but known achievement (gray) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment