Skip to content

Instantly share code, notes, and snippets.

@sodabiscuit
Last active May 9, 2018 12:40
Show Gist options
  • Save sodabiscuit/c1a351b9318bbbe52de414fe2e7dda6d to your computer and use it in GitHub Desktop.
Save sodabiscuit/c1a351b9318bbbe52de414fe2e7dda6d to your computer and use it in GitHub Desktop.
random_rename_corp
#!/usr/bash
# while read p; do
# url="${p}?x-oss-process=image/resize,w_1000/quality,Q_60"
# wget $url -O ${p##*/}
# #sleep .5
# done <./images
random_files=`ls ./shop | gshuf -n 6000`
unset IFS
for f in $random_files; do
name=${f##*/}
IFS='_' read -r -a array <<< "$name"
r1=`echo $RANDOM + 20000 | bc | md5 | cut -c1-15 | tr '/a-z/' '/A-Z/'`
#c1=`echo $RANDOM%100 + 1 | bc`
crop1=`gshuf -i 70-100 -n 1`
#f1="${array[0]}_${array[1]}_${r1}.jpg"
f1="${r1}.jpg"
cp ./shop/$f ./shop1/$f1
convert ./shop/$f -resize ${crop1}% ./shop1/$f1
#jpegoptim ./shop1/$f1 -m $c1
#cp $f ./shop1/$f1
#mogrigy $f -crop ${crop1}%x${crop1}%+0+0
#echo ${crop1}%
#mogrify ./shop1/$f1 -resize ${crop1}%
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment