Casualty 14 -18 ~ The making of a generative artwork by Richard Bolam – Part 5 #bolamat50 #casualty1418 #WW1

Screen shot 2014-08-01 at 09.59.29

This version of the script adds the functionality of creating a discrete folder for each day and labelling all the images with the derived current date rather than a literal.

I found information on how to derive and format dates here. The dates are formatted one way on the sheets, to be more human-readable, and alpha-numeric-sorting-friendly for the folders and files.

#!/bin/bash
#casualty make script v4

mkdir ‘Casualty1418-‘$(date +”%y_%m_%d”)
PATHNAME=’Casualty1418-‘$(date +”%y_%m_%d/”)

for i in {1..30}

do

#pad figure
convert casualty.png -gravity center -extent 20×38 casualtypad.png

#create tiled image of figures & make background transparent
convert -size 400×646 xc:white -composite tile:casualtypad.png casualtytiled.png
convert casualtytiled.png -transparent white casualtytiled.png

#colourise regions
REPEATS=$[1 + RANDOM % 20]
MAXWIDTH=$[$RANDOM %20]
MAXHEIGHT=$[$RANDOM %17]

for r in {1..3}
do

LEFT=$[$[RANDOM % 20]]
TOP=$[$[RANDOM % 17]]
RIGHT=$[$[RANDOM % (20 – $LEFT)]]
BOTTOM=$[$[RANDOM % (17 – $TOP)]]

echo $LEFT”,”$TOP”,”$RIGHT”,”$BOTTOM” – “$REPEATS
convert casualtytiled.png -region $[$LEFT * 20]x$[$TOP * 38]+$[$RIGHT * 20]+$[$BOTTOM * 38] -fill “rgba(255,255,255)” -colorize 20% casualtytiled.png
#convert casualtytiled.png -region $[$LEFT * 20]x$[$TOP * 38]+$[$RIGHT * 20]+$[$BOTTOM * 38] -fill “rgba($[RANDOM % 255],$[RANDOM % 255],$[RANDOM % 255])” -colorize 50% casualtytiled.png
#convert casualtytiled.png -region $[(1 + $[RANDOM %20])*20]x$[(1 + $[RANDOM % 17]) * 38]+$[((1 + $[RANDOM % 20]) * 20)]+$[((1 + $[RANDOM % 17]) * 38)] -fill “rgba(255,255,255)” -colorize 20% casualtytiled.png
#echo $r
done

#create page dimensions
convert casualtytiled.png -bordercolor white -border 99×90 casualtypage.png
convert casualtypage.png -gravity north -extent 598×850 casualtypage.png

#create label
convert -background white -font Gill-Sans -pointsize 10 -size 598×20 -gravity center label:’Casualty 14-18 ~ ‘$(date +”%d/%m/%y”)’ – ‘$(printf %02d $i) Casualtylabel.png

#composite page & label
FILENAME=’Casualty1418-‘$(date +”%y_%m_%d-“)$(printf %02d $i)’.png’
convert casualtypage.png -page +0+760 casualtylabel.png -layers flatten $PATHNAME$FILENAME

done

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s