Skip to content

Instantly share code, notes, and snippets.

@mitsu-ksgr
Created August 17, 2019 08:21
Show Gist options
  • Save mitsu-ksgr/fc59f24a6989fbb172bbae2b690110f7 to your computer and use it in GitHub Desktop.
Save mitsu-ksgr/fc59f24a6989fbb172bbae2b690110f7 to your computer and use it in GitHub Desktop.
get image size in shellscript
#!/bin/bash
# require: image magick
file_path="/path/to/image.png"
size=$(identify -format "%w,%h" $file_path)
w=${size%,*}
h=%{size##*,}
echo "$file_path: $w x $h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment