Created
May 3, 2017 14:32
-
-
Save twobob/32c7d3015c42d9ffb1328ef2f504592a to your computer and use it in GitHub Desktop.
pyhon snippet to check if a file is landscape or portrait with ImageMagick
This file contains 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
import os, subprocess | |
subprocess.run(['Magick', './IMG_3160.jpg' ,'-identify' , '-format' ,'"%[fx:(w/h>1)?1:0]"','info:'], stdout=subprocess.PIPE).stdout.decode('utf-8')[-2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't work on iPhone landscape picture, the W is higher than the H on Linux
Please find the solution :