Quickest method to display image dimensions for files in Nautilus in List View?

There is a package called nautilus-columns. I currently find it only in a PPA, which is documented here. With this little script its easy to add columns for various meta data for PDF, images, sound files etc. To sum all things up:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install nautilus-columns
nautilus -q

Finally go to Edit > Preferences > List Columns and enable all you need. Please note, its only working for the List-View.

Current versions of nautilus-columns can also be found here.


Use a script! For things not in Nautilus by default you can add scripts yourself.

More information on ubuntuforums. The topic starts out adding music information but from reply #32 it also involves images. Scripts (use at own risk) and instructions in the link.

Look at the screenshot for how this will look (it's for an older Ubuntu but this still works):

enter image description here


Run this from a terminal (works for PNG and GIF images):

file *.{png,gif}

That works because the file command shows the dimensions for PNG and GIF images, as well as some other information. Your shell expands *.{png,gif} to a list of filenames, and the file command accepts multiple filename arguments. It looks like this:

btvs-cordelia-probable-syntax-error.png: PNG image data, 1920 x 1080, 8-bit/color RGB, non-interlaced
cross.png:                               PNG image data, 1039 x 611, 8-bit/color RGB, non-interlaced

Notice that the columns are lined up, so extra space is used if some names are much longer than others. If you don't want that, use the -N option:

file -N *.{png,gif}

That gives you lines like this, which no longer take up extra space, but are no longer aligned:

btvs-cordelia-probable-syntax-error.png: PNG image data, 1920 x 1080, 8-bit/color RGB, non-interlaced
cross.png: PNG image data, 1039 x 611, 8-bit/color RGB, non-interlaced

In the rare case where you have many thousands of image files, their names might exceed the maximum combined argument length, and the shell would give you an error message. In that case, you could use a loop like this:

for f in *.{png,gif}; do file "$f"; done

That produces the same results as file -N because, since file only knows about one file per run, so it doesn't know how long the other filenames are and it cannot align the columns.

For other image types, see ypnos's answer to Fast way to get image dimensions (not filesize).