FE Nautilus Scripts

DESCRIPTION and
CODE SAMPLES



(FE = Freedom Environment)

FE Home page > FE Overview page > This FE Nautilus Scripts Description page

! Preliminary ! More 'Nautilus' scripts may be added ---
and the scripts here may be touched up or revised occasionally.

< Go to Table of Contents, below >
(SKIP THIS LONG INTRO)

INTRODUCTION :

In 2009, I finally 'took the plunge' and migrated my mail, bookmarks, etc. from a (main) Microsoft Windows machine to a (main) Linux machine. I have documented reasons why I went to Linux, along with install notes, on an Ubuntu Install notes page

I do a lot of web page development in which a lot of photos and other image files are processed (renamed, cropped if need be, down-sized, gamma-corrected if need be, thumbnailed, etc.).

I found that I really missed the (free) Irfanview program available only for MS Windoze. I am not the only one in that regard. You can do a web search on terms like 'irfanview linux replacement image processing' and you will find many people who feel the same way.

I have done a lot of web searching for suitable replacements, and in the area of 'batch' interactive cropping and resizing (rescaling), I find the 'Mirage' program to be the handiest to quickly go forward (and backward) through a directory of images, to crop them, according to the way I want to compose the view. BUT I do not use it. I use 'mtpaint' instead.

Unfortunately, Mirage does compression when saving a JPEG file, with no user-control allowed on the compression --- which Irfanview allows. This can really be problematic if you have to process the file multiple times. You can end up with a really fuzzy looking file.

    Another drawback: Mirage makes thumbnails of ALL image files in the current directory, whether you want them or not. I am often dealing with directories holding on the order of a hundred image files. I do not want tiny thumbnails of all those images. When I want thumbnails, I will make them the size that I need them.

The 'mtPaint' program allows for compression control when saving a JPEG file --- and it allows for easy gamma-correction (which is nice for dealing with over or under exposed images) --- BUT mtPaint does not allow for quite as quick navigation (as Mirage) within a directory of image files.

    Another drawback: mtPaint does not show animated GIF files ... but Mirage (or almost any web browser) does.

    mtpaint is easily installed via Applications > Ubuntu Software Center, from the top panel in Ubuntu 9.10 (Karmic Koala).


The truth emerges :

Although 'mtPaint' will suffice for interactive cropping of images, it does not have facilities like Irfanview has --- for batch re-sizing of selected files, for batch renaming of those selected files, and for batch direction of the new files into a different directory. And I cannot find any image editor program on Linux that does that combination of functions.

It finally became clear to me that I was going to have to use the ImageMagick command-line program 'convert' to write my own scripts for 'batch' file-resizing-renaming-redirecting and for other batch image processing, like conversion of batches of selected '.png' and '.gif' files to '.jpg' files.

Image processing exceptions to using ImageMagick 'convert' :

  • for [interactive] cropping, I use 'mtpaint'.
  • for [interactive] gamma-correction, I use 'mtpaint'.
  • for [interactive] addition of text, I use 'mtpaint'.
  • for [interactive] addition of arrows or ovals, I use 'mtpaint'.
  • for [interactive] red-eye touchup, I use 'mtpaint'.
  • for [interactive] smudging of text (anonymizing), I use 'mtpaint'.

In the image processing scripts, I use mainly the ImageMagick 'convert' program --- and I use the ImageMagick 'identify' program to get the X-and-Y pixel size of image files, for automated file renaming.

Writing these scripts was not a big deal for me since I was a computer programmer / analyst / engineering-software-installer for many years, including about 10 years on Unix (mostly on SGI IRIX). Besides, I wanted to automate the process of generating HTML web pages of thumbnail images, with links to the larger sized images --- using shell scripts.

This isn't so easy to do on MS Windohs, because of its really feature-poor DOS command shell --- and alternatives cost too much $$$$. It would be like buying a sledgehammer to pound in a few nails. And paying again and again and again, at almost every sledgehammer (or MS operating system) upgrade.


Thank you, Nautilus :

The 'Nautilus' file manager on Ubuntu (and other Gnome Linux distros) provides for running your own scripts against zero or more files selected in a directory. You simply put the scripts in a special 'hidden' directory --- .gnome2/nautilus-scripts --- in your home directory.

    In my case, I have so many Nautilus scripts, I put them in subdirectories of the ~/.gnome2/nautilus-scripts directory. Those sub-directory names show up in the Nautilus 'Scripts' submenu.

    Each of those 'group' names then has its own Nautilus submenu, by the magic of Nautilus. Some screen images are below.


More than image processing :

After collecting about ten scripts for image processing, I realized that I could use Nautilus scripts to handle other tasks quite quickly --- tasks like

  • listing files in (or under, recursively) a directory at which I was positioned in Nautilus --- in the ways I wanted/needed to list the files (with the ability to paste sections of the lists into other files --- such as scripts).

  • finding files, even in 'hidden' directories. Currently (2010), the Nautilus (2.28.1) search utility will not search 'hidden' directories, even if you use the 'Show hidden and backup files' option under 'Select more options' on the 'Search for Files' panel.

  • listening to selected or all audio (mp3) files in a directory at which I was positioned in Nautilus.

  • converting movie files from one format to another, when positioned in a video files directory via Nautilus.

  • capturing movie files from the computer monitor and the audio card/circuitry of my computer --- and clipping, cropping, and otherwise editing movie files.

I have started collecting so many useful scripts that I have put them in separate directories to make it easier to choose from shorter lists of scripts. (It's helpful to try to keep the lists down to less than 20 script names.)

As the following (slightly outdated) image shows, I have separated the scripts into directories named

  • AUDIOtools
  • CHANGEfiles
  • EXAMINEfiles
  • FILESlists
  • FINDlists
  • IMAGEtools
  • LinuxHELPS
  • PROC-MEMlists
  • SPACElists
  • TERMtools
  • VIDEOtools
  • zMORE

The 'zMORE' category allows access to about 15-plus more categories (sub-directories) of scripts.

You can see how the Nautilus scripts are presented, by filename, in this (old, 2010) image of the IMAGEtools group and in this (old, 2010) image of the FINDtools group.

To use any of the scripts in these groups, navigate to a directory in Nautilus, right-click on any file in the directory, and hold the cursor over the word 'Scripts' in the Nautilus popup menu. The menu of groups pops up. Then slide the mouse cursor over to a group name. The group submenu pops up. Then slide the mouse cursor over the name of a script and click on it to execute it.

If the script is written to accept the names of MULTIPLE high-lighted files, before doing the right-click, select the files --- using the Ctrl or Shift keys as needed.

Some scripts do not accept names of high-lighted files, such as the TERMtools scripts. Just navigate, in Nautilus, to the desired directory and select any file in the directory --- to get to the desired script-name in the Nautilus TERMtools menu, to click on the script name. The terminal opens up positioned at that directory.

    The TERMtools 'terminal' scripts are helpful in testing scripts and executing commands at a command prompt --- in a directory of image files, or audio files, or scripts, or whatever.

To cut this story short --- code samples of scripts in the groups of Nautilus scripts are accessible via the Table of Contents, below. (I do not guarantee that these code images are exactly in sync with the scripts in the latest self-extracting install script on the FE Nautilus Scripts download page.)

The table of contents below provides links to separate web pages that show the scripts' source code. The links are in alphabetical order, according to group names listed above (which are also subdirectory names in ~/.gnome2/nautilus-scripts/).


A Little Venting :

It is really annoying (to me) to read comments in forums (from SUPPOSEDLY 'expert' linux users) that GIMP is the answer to any Linux user's image processing needs, whenever anyone reports a problem with image processing on Linux. GIMP does NOT handle batch processing of images efficiently.

If these know-it-alls ever had to process hundreds of images --- including the many steps I have mentioned above, such as batch renaming, 'fast' cropping, 'fast' gamma-correction, batch image resizing (usually down-sizing), batch thumbnailing, and even batch HTML page generation --- those 'idiots' who call everyone else 'idiots' would perhaps begin to understand the issues.

If they haven't done that kind of image processing, they should keep their USELESS comments to themselves. Quit junking up forums with that knee-jerk nonsense.

End of vent .... for now. (More may be added later.)

Table of Contents:    (links to pages of scripts)

Some notes on presentation of these scripts are below.

End of Table of Contents. See the warning notes below.

How the code samples are presented on the FE Nautilus Scripts CODE pages
- and other code-related notes :

Each of the nautilus-script code samples is presented as a link to a '.txt' text file. Click on the link and you can browse the text in your web browser. And you can right-click on the link to use as option such as 'Save Link Target As ...' to save the script code in a local file on your computer.

The four-part naming convention used for the FE Nautilus Scripts is explained on a FE Nautilus Scripts Naming Convention page.

Generally, in the scripts, I use double-# (##) to indicate a true comment. That is, it is not an executable statement and should never be de-commented.

I use single-# (#) to indicate an executable statement that has been commented. Typically this is because I might want to decomment the statement when doing testing of the script in a terminal window. Generally, the statement should be re-commented --- or a neighboring statement should be commented --- when finished testing.

I do not try to make one-liner scripts, nor do I try for the absolute ultimate in processing efficiency. (But I am aware of several things to avoid that would make scripts run as slow as molasses.) I try to make the scripts readable (to me). At the same time, they generally execute quite rapidly, even on a directory containing over a hundred files. These scripts can be MAJOR time savers.

The FE Nautilus Scripts use a special technique to get the filenames of one or more user-selected files in a Nautilus file manager window. That technique is described on the FE Nautilus Scripts DOWNLOAD page.


Navigation :

Use the 'list of code-links' (on each of the 'group of FE Nautilus Scripts' web pages) to see each listing of a script. Simply scroll down the 'group-of-scripts' page to spot script-names of interest.

Alternatively, use the 'Find text' option of your web browser to look for keywords on the 'group-of-scripts' page. For example, on the 'IMAGEtools' page, when looking for examples of scripts using the ImageMagick 'convert' or 'identify' command, use FindText keyword 'convert' or 'identify' --- or when looking for a script involving 'jpg' or 'png' or 'gif' files, use keyword 'jpg' or 'png' or 'gif'.


Shell considerations :

Most of these Nautilus scripts were written so that they can run via the Bourne or the Korn shells (command interpreters), as well as via the Bash command interpreter. Most of these samples employ Linux/Unix commands (and their parameters) available to all three interpreters, so the scripts will generally run in any of these three interpreters.

In fact, the Korn and Bash interpreters are offshoots of the Bourne command interpreter.


Caution / Warnings :

Most of the scripts do not change any files selected by the user. Most of the scripts accept a file (or files) as input, but put the results in a new file (or files). Hence, there is no harm to be done. You can examine the code, to erase doubt.

On the other hand, the code is presented here mostly for my own personal use --- as a reference (for example, from different computers, at home or away) and as a means of organized archival and backup. I may use portions of the scripts for working code fragments to be applied in other scripts.

If other people use these scripts, they should test them on test data before using in a 'serious' mode.

Example: Even if I have used a batch ('multi-file') image-processing script many times, when I go to use it again, on, say, 60 image files, I apply it to the first 3 image files. If that goes OK (usually you see results such as new files popup almost immediately in the Nautilus directory view), then I apply the script to the remaining 57 image files.


WEB LINKS to other Nautilus scripts :

< Go to Table of Contents, above. >

You can look for other Nautilus scripts via a Google search on 'nautilus scripts'. You may wish to add keywords such as 'image processing' or 'crop' or 'resize' or 'transparent' or whatever.


For example, this g-scripts link at sourceforge.net provides Nautilus scripts (about 30?) in several categories:

  • Archiving
  • Executing
  • File Info
  • File Processing
  • Multimedia
  • File System Management
  • System Configuration

This forumubuntusoftware.info link provides a description (in English) of 70 Nautilus scripts that are downloadable from a gnome-look.org page.

And I have seen a 'Google hit' that mentioned 125 Nautilus scripts. But I have not seen a site yet that offered 450-plus Nautilus scripts --- other than this site.     :-)

"FE Nautilus Scripts . . . . Lots of Hammers for Your Various Nails."

Bottom of the FE Nautilus Scripts - Category Menus page.

The code samples in the category pages provide shell-scripting beginners (and some experienced developers) examples of shell-script code that use techniques, command-line tools, and parameters that they may not be experienced in using. Hence these are development time-savers.

To return to a previously visited web page, click on the
Back button of your web browser a sufficient number of times.
OR, use the History-list option of your web browser.
OR ...

< Go to Table of Contents, above. >
< Go to Top of Page, above. >

OR ...

< Go to FE Home page >

Page created 2010 Aug 22. Changed 2014 Apr 30.