Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created November 15, 2013 04:25
Show Gist options
  • Save matthewpoer/7479060 to your computer and use it in GitHub Desktop.
Save matthewpoer/7479060 to your computer and use it in GitHub Desktop.
Script to take a few input png files (e.g. 25x40 named blue_Marker.png) and create 0-99 annotations for them
<?php
$colors = array('blue','green','grey','navy','orange','purple','red','yellow');
foreach($colors as $color){
echo $color;
$text = "[foodbank {$color} blank]";
$root_file = $color.'_Marker.png';
for($i=00;$i<100;$i++){
echo $i;
$num = strval($i);
if(strlen($num) == 1){
$size = '8,18';
}else{
$size = '3,18';
}
$new_file = $color.'_Marker'.$i.'.png';
system("cp {$root_file} {$new_file}");
system("mogrify -draw \"text {$size} '{$num}'\" -fill white -font Verdana-Bold -pointsize 14 {$new_file}");
}
echo "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment