Skip to content

Instantly share code, notes, and snippets.

@y56
Created June 4, 2021 03:56
Show Gist options
  • Save y56/67f283c90a0bf3b375aa40f5857c0c6b to your computer and use it in GitHub Desktop.
Save y56/67f283c90a0bf3b375aa40f5857c0c6b to your computer and use it in GitHub Desktop.
[shell] compare image height and width, and then do sth
for f in *.png;
do
if [ $(file "$f" | cut -d ',' -f2 | cut -d ' ' -f2) -gt $(file "$f" | cut -d ',' -f2 | cut -d ' ' -f4) ]
then
echo "width > height"
else
echo "width < height"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment