0

I have an image called a.jpg. I use "feh - imlib2 based image viewer" to get the information about image dimension. The command I use is

feh -l a.jpg

And the result is

NUM FORMAT  WIDTH   HEIGHT  PIXELS  SIZE(bytes) ALPHA   FILENAME
1   jpeg    1280    960     1228800 91319       -       a.jpg

Now I have around 160,000 image in my directory, I'd like to export those image dimension to text. The command I use is:

feh -l * > dimension.txt

But when I do, it says:

bash: /usr/bin/feh: Argument list too long

Anyone know what is the proper command?

1 Answer 1

1
find . -type f -print0 | xargs -0 feh -l > dimension.txt

find generates filenames for all files in subdir (and recursively too, if that's a problem, add -maxdepth 1 to the find command), it sends them as ZERO byte terminated data to xargs. We do this to be able to properly handle filenames with spaces (and other junk).

xargs gathers the names, putting as many as it can on each command line used to run feh. It re-runs the command line until all the names are used.

There is also the identify program from the imagemagick package, it does much the same as the feh -l command, showing dimensions. Usage for this many files would be similar, replacing feh -l in the xargs command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .