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

1,306

Solution 1

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

Solution 2

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.

Solution 3

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).

Share:
1,306

Related videos on Youtube

subair_a
Author by

subair_a

Updated on September 18, 2022

Comments

  • subair_a
    subair_a almost 2 years

    I need to call a c++ function from the javascript. Please somebody hlp..

    • dthorpe
      dthorpe over 13 years
      Javascript running in the browser? Javascript running on the web server? Please be more specific.
    • jrharshath
      jrharshath over 13 years
      and perhaps also state what you're actually trying to do. The solution might not involve c++ (or javascript) at all.
  • Nathan Osman
    Nathan Osman over 13 years
    +1 Very good answer. That's the first thing that popped into my head too.
  • subair_a
    subair_a over 13 years
    then how to compile a class to dll, please give a step to step example or a link to better tutorial. Its first time I'm working with this kind.. Thanks in advance..
  • Ratna Dinakar
    Ratna Dinakar over 13 years
    If you are using VisualC++ you have options creating for DLL within the IDE.
  • unpossible
    unpossible about 13 years
    I should have said in my original post that I also tried installing nautilus-columns package: $ sudo add-apt-repository ppa:nilarimogard/webupd8 $ sudo apt-get update $ sudo apt-get install nautilus-columns I then added all image-related columns to Nautilus' view and restarted Nautilus. Date, EXIF Dateshot, EXIF Image Size, EXIF Software, EXIF Flash columns are all blank. The only column that displays info is Image Size, which displays the dimensions of each image. Any idea how to resolve this before looking into custom scripts? Do I need to install another package(s)? Thanks
  • unpossible
    unpossible about 13 years
    Update: I installed the bsc-v2.py script on Ubuntu 10.10 PC at work, as per instructions on ubuntuforums thread, which works. Whilst installing Ubuntu 11.04 at home, I selected option to encrypt my home directory. I suspect this may be the cause of this issue, as I had a similar issue with Apache trying to serve files and folders in my home directory.
  • unpossible
    unpossible about 13 years
    Update: I removed encryption from my home folder on 11.04, but the EXIF data is still blank. Has anyone managed to get this working on Natty? If so, how?
  • Umair A.
    Umair A. over 10 years
    Works in 13.04 too
  • Hastig Zusammenstellen
    Hastig Zusammenstellen over 7 years
    Works with 16.04. The one thing I will point out to future readers is to remember that 'exif image size' will be different than 'image size', so check the box for 'image size' if you want the true image size, not the image dimensions when the photo was taken or exif was last updated.