Skip to content

Instantly share code, notes, and snippets.

@valchonedelchev
Created November 11, 2016 12:27
Show Gist options
  • Save valchonedelchev/d2acf07a339a00dfd5328a570c3544fe to your computer and use it in GitHub Desktop.
Save valchonedelchev/d2acf07a339a00dfd5328a570c3544fe to your computer and use it in GitHub Desktop.
Detect image orientation based on image size and prints it out
#!/bin/bash
# File: /usr/bin/local/image-orientation
test=$(convert $1 -format "%[fx:(w/h>1)?1:0]" info:)
if [ $test -eq 1 ]; then
echo horizontal
else
echo vertical
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment