Skip to content

Instantly share code, notes, and snippets.

@forkrul
Last active March 10, 2019 11:51
Show Gist options
  • Save forkrul/501ab62e8a13050e19a2ddb36447ebe4 to your computer and use it in GitHub Desktop.
Save forkrul/501ab62e8a13050e19a2ddb36447ebe4 to your computer and use it in GitHub Desktop.
# strip orientation
exiftool -all= *.jpg # also strips orientation
# fix portraits in gwenview.
# convert sony camera items from raw to jpg
ufraw-batch *.ARW --out-type=jpeg --compression=99
# landscape portrait separation
mkdir portrait
mkdir landscape
for i in *.jpg;
do
type=$(-format '%[exif:orientation]' $i)
case $type in
1)
mv $i portrait;;
6)
mv $i landscape;;
8)
mv $i portrait;;
esac
done
cd portrait
for filename in *.jpg; do
[ -e "$filename" ] || continue
convert $filename -fuzz 10% -trim +repage \( -clone 0 -resize 200x100% -blur 0x10 \) +swap -gravity center -compose over -composite result-$filename
#crop from centre -gravity center -crop WxH+0+0 +repage
done
# convert all images to 768 height, keep aspect ratio
mogrify -geometry x768 *.jpg
# randomize filenames
for i in *.jpg; do mv $i $(openssl rand -rand $i -hex 23).jpg; done
#convert SONY ARW
ufraw-batch *.ARW --out-type=jpeg --compression=99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment