Skip to content

Instantly share code, notes, and snippets.

@peshmerge
Created October 15, 2017 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peshmerge/8889306b7aa27de3480e965baab8f95e to your computer and use it in GitHub Desktop.
Save peshmerge/8889306b7aa27de3480e965baab8f95e to your computer and use it in GitHub Desktop.
create.sh
#!/bin/bash
#!/usr/bin/phantomjs
imageCounter=0
missedIamgeCounter=0
for year in {2015..2017}
do
for month in {1..7}
do
#This line gets the number of days for each month based on Linux Cal
amountOfDays=$(cal $month $year | awk 'NF {DAYS = $NF}; END {print DAYS}')
for ((day = 1; day<=$amountOfDays; day++))
do
((imageCounter++))
phantomjs takeScreenshot.js $day $month $year
echo "Searching for Image $year-$month-$day.png "
if [ -e $year-$month-$day.png ]
then
echo "Image $year-$month-$day.png found!"
echo "Cropping Image!"
convert $year-$month-$day.png -crop 1460x1230+650+310 $year-$month-$day.png
echo "Finished Cropping....!"
else
echo "Image $year-$month-$day.png NOT FOUND!"
((missedIamgeCounter++))
fi
done
done
done
if [ $imageCounter -eq $missedIamgeCounter ]
then
echo "Nothing went Wrong we have $imageCounter images"
else
echo "We miss $missedIamgeCounter"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment