Home🏠
Members only🧡
Tips💸
  • Image

    Collage a la Thief Gold: When my Quickload key is bound to Screenshot and ImageMagick is still the most straightforward way to make a grid of images

    Hiya all, we finished up the Thief Gold playthrough (which was a ton of fun!) a few weeks ago now. I really enjoyed it and hope you all had a fun time watching me try and fail to sneak through crypts. Garret is a master thief, unfortunately I am not - which is why I have quickloaded some 423 times! 

    At first it was a little gag when I noticed Thief had F12 as quickload, the same key as Steam's screenshot feature, but decided to roll with it because it was funny

    Here's a Collage of all the Thief screenshots, many of which are me staring at the thing about to kill me!

    Making the Collage

    A little fun aside would be that searching online for collage makers sucks. All of them are 'free' and 'easy to use' but become bogged down in account signups and limits and pushing towards paid features to use a clunky UI that probably can't even do this many images anyway. Ew.

    I also didn't want to pay Adobe a single cent for something like InDesign. 

    Enter: ImageMagick! The library that supports a ton of modern internet infrastructure already (and likely all of these collage websites) whilst being free, open-source, and dead simple to run locally.

    You can install it from your local commandline (Linux/WSL) - however apologies if Fourthwall doesn't keep the code formatting, I think the editor for these doesn't yet support it!

    `sudo apt-install imagemagick`

    Then navigating to your folder (I used thumbnails from the steam screenshots, which were given in the same folder, since otherwise the full resolution ones do seem to need more memory than I can get to process it) and running the following command:

    DOCS HERE: https://legacy.imagemagick.org/Usage/montage/#tile

    This creates a montage (grid arrangement) of your supplied images, in my case in my `thumbnails` folder, and the * wildcard to expand into every filename in that folder. Standard unix rules apply like being careful with spaces in names since in the commandline they will be treated as seperate arguments!

    Thankfully steam's default naming scheme has no whitespace so it's pretty simple to convert.

    `montage thumbnails/* collage.png`

    This image has a bunch of whitespace added automatically around each image, as well as an automatic calculation for the number of rows and columns to organise your images in.

    I don't really want all the whitespace so the part to look for in the ImageMagick manual is the `-geometry` option. By default it puts a few pixels between each image horizontally, and a few more vertically. Getting rid of this spacing means replacing the horizontal and vertical width with zero like so:

    `montage thumbnails/* -geometry +0+0 collage1.png`

    This is much better for a collage of this many screenshots I think!

    But there's a big long bar at the bottom, and I could fill this with another colour, but ideally I'd want to find the number of rows and columns that have as little space as possible. This'll change the shape of the image, but makes it a little more pleasing IMO.

    With 423 images, we can look at the factors of 423 (1, 3, 9, 47, 141, and 423) to find possible dimensions with zero whitespace:

    • 9 × 47
    • 47 × 9
    • 3 × 141
    • 141 × 3

    But these are all quite long, so there's nothing perfect that will be in a more even aspect ratio.

    Looking online, this needs a minimisation. I'm very rusty on my Maths (not Math, we keep the s in Australia!) so this was a neat little learning exercise even if it's pretty simple.

    Every combination of rows and columns, 'r' and 'c', produces 't' many tiles: So, `r * c = t`, which needs to be greater than or equal to than our amount of images to fit in the space, 423.

    The square root of 423 is 20.56..... meaning some row from 1 up to 21 should be a valid solution. The ideal aspect ratio for an image to be viewable nicely would have the rows and columns reasonably close to the same size

    For each row, you can check what the column size would be to fit all images by `c = 423/r`, then rounding up to make sure it won't have less tiles than images.

    What we want to minimise are the wasted spaces left over, `t - 423 = w`

    e.g. 10 rows would be 423/10 = 42.3 columns, rounding up to 43. This makes 10 * 43 = 430 tiles, - 423 images = 7 wasted spaces left. 

    So, trying a few by plugging the formulas into a spreadsheet gives:

    Highlighting everything smaller than 5 wasted spaces, shows that a lot of very wide column solutions work, but there is one with only 2 wasted spaces and a decently squarish ratio of rows to columns, 17 * 25!

    Can use `-tile 17x25` in our collage generation to get the main one I've used here!

    `montage thumbnails/* -tile 17x25 -geometry +0+0 collage6.png`

    Thanks for reading! I hope if you're looking to make collages like I was, and stumbled across this little blog post, that it helps a little!

    And thank you all members for your patronage and to all who watch my streams!