Last active
December 24, 2015 06:39
-
-
Save josnidhin/6758546 to your computer and use it in GitHub Desktop.
Parses the filename and adds it as a text to the image using imagemagick tool
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
#! /bin/bash | |
# | |
# This script parses filenames of the following format "s1_c-sq-0x_1_1369921304_1.PNG" and add | |
# certain info to the image | |
# | |
FILES=*.PNG | |
for file in $FILES; do | |
while IFS='_' read -ra filename; do | |
USER="${filename[0]}" | |
VIEW="${filename[4]}" | |
while IFS='-' read -ra type; do | |
if [[ ${type[0]} == "c" ]]; | |
then | |
TYPE="Direct" | |
ORIENT="${type[2]}" | |
else | |
TYPE="${type[0]}" | |
ORIENT="${type[3]}" | |
fi | |
done <<< "${filename[1]}" | |
done <<< "$file" | |
convert $file -background White -weight bold -pointsize 40 label:"$USER $TYPE $ORIENT" -gravity Center -append "output/$USER $TYPE $ORIENT $VIEW" | |
done |
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
#! /bin/bash | |
# | |
# # This script parses filenames of the following format "S4 DIRECT 0X.jpg" and add | |
# certain info to the image | |
# | |
FILES=*.jpg | |
for file in $FILES; do | |
while IFS='.' read -ra filename; do | |
NAME="${filename[0]}" | |
done <<< "$file" | |
convert "$file" -background White -weight bold -pointsize 40 label:"${NAME} IMFs" -gravity Center -append "output/${NAME}_%d.jpg" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment