Reputation: 319
I want to see the image dimensions of all the jpg images together in a list through a command line in Linux. Following code works for only one image.
identify -format "%wx%h" xxxx.jpg
Upvotes: 5
Views: 3162
Reputation: 147
The only issue I have with the other answers is that you have to be in the same directory as the images.
So a solution that avoids this chains xargs together:
ls folder | xargs -I % echo "path_to_folder/%" | xargs identify -quiet -ping -format '%w %h\n'
Note this only works for one folder not multiple subfolders.
Upvotes: 2
Reputation: 91
if you have files with spaces in their names, you can use this command, which specify '\n'
as delimiter.
ls *.jpg | xargs -d '\n' -L1 identify -format "%wx%h\n"
and if you want to have a mapping of filenames to dimensions you can use %f
in your pattern:
ls *.jpg | xargs -d '\n' -L1 identify -format "%f: %wx%h\n"
Upvotes: 4
Reputation: 1863
I think this is what you need
xargs identify -format "%wx%h\n" < <(ls -tr1)
or
ls -1 | xargs -L1 identify -format "%wx%h\n"
Upvotes: 6