Skip to content

Instantly share code, notes, and snippets.

@deltheil
Created June 12, 2012 09:54
Show Gist options
  • Save deltheil/2916633 to your computer and use it in GitHub Desktop.
Save deltheil/2916633 to your computer and use it in GitHub Desktop.
JPEG images: EXIF orientation
# 1/ Read EXIF orientation flag
identify -format "%[EXIF:orientation]" myimage.jpg
# NOTE: jhead can be used too
# see http://www.sentex.net/~mwandel/jhead/
jhead -exifmap myimage.jpg | grep Ori
# 2/ Remove EXIF orientation
# i.e. rotate the image accordingly and reset the orientation
# flag to 1 (default, i.e. origin = TopLeft)
# WARNING: the image file is overwritten!
# NOTE: it also works with a wildcard: jhead -autorot *.jpg
jhead -autorot myimage.jpg
# NOTE: to simply reset the orientation flag w/o applying any
# rotation, use the -norot option instead
jhead -norot myimage.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment