Neat Image Photoshop Automation via JavaScript


This is a utility script that will invoke Photoshop actions that have been recorded to use the Neat Image Pro+ Adobe Plug-in filter.   The objective is simply to allow automation when dealing with a large number of images from an event shot with multiple cameras under varying lighting conditions.   This article will assume that the reader is familiar with Neat Image Pro+, has created or acquired camera profiles, and used the Photoshop plug-in interactively at least.   And that the user is familiar with creating (recording) Photoshop actions.

There are no user dialogs with this script, but there are some configuration options.   These will be described later.   The basic processing is to examine the image metadata to determine which NeatImage action to use.   Below a user defined ISO and shutter speed, noise reduction is skipped completely.   Above another user defined ISO threshold, an aggressive NeatImage action is selected.   Anything else will select a NeatImage action that applies a default (moderate) noise reduction.

Before calling the NeatImage action the script can create a merged layer that will be used for noise reduction.   If the image is saved with layers, this layer opacity can be faded later.   There are two reasons for preparing this in the script.   Obviously, it allows you to fade the effect if desired.   It also protects you if the input image has multiple layers, such as adjustment layers.   If you donít create a separate layer, NeatImage may try to apply to the wrong layer, such as an adjustment layer.   This is difficult to handle in a Photoshop action.

So, to use this script, you will need to create at least two NeatImage actions in Photoshop.   And you may want to modify some of the script defaults.   These are described next.  


   // ================================================================
   // Configuration
   // ================================================================
   var userActionSet = "NeatImageActions";    // all actions in this set
   var lowNoiseAction = "none";               // NI action: low ISO images
   var midNoiseAction = "NeatImageDefault";   // NI action: average images
                                              //  (default preset)
   var highNoiseAction = "NeatImageStrong";   // NI action: high ISO images
                                              //  (remove all noise preset)
   var noExifNoiseAction = "NeatImageNoExif"; // NI action: auto fine tune
                                              //  (default preset)
   var profiledCameras = [                    // start profiled cameras
                          "NIKON D200",
                          "NIKON D1X",
                          "DCS Pro SLR/n"
                         ];                   // end profiled cameras 
   var lowISO = 200;                          // use lowNoiseAction for ISO
                                              //  at/below this threshold
   var thresholdShutter = 1/4;                // force NI for shutter
                                              //  at or slower than this
   var highISO = 800;                         // use highNoiseAction for ISO
                                              //  at/above this threshold
   var newLayerName = "NeatImage";            // default NI layer name
                                              //  ("" for no layer)
   var layerOpacity = 90.0;                   // default NI layer opacity
   var debugAlerts = false;                   // show diagnostic alerts
   var redrawScreen = true;                   // show updated image in PS

Note that these are defaults only.   You will likely want to make some small adjustments.   This should not require a high degree of programming skill but you need to adhere to some basic rules.   On each line, var defines a variable and the variable name follows.   Do not change these.   The configuration value follows the equal sign and ends with the semicolon.   Do not remove any quotes.   Note that true and false are keywords.   Everything after the // is merely a comment.   These lines are all near the top of the script.   You can edit them with a text editor or double click the script file from Windows Explorer or your file browser and it should open with the Adobe ExtendScript TookKit.

First is the Photoshop action set where you recorded your NeatImage actions.   Either create them in "NeatImageActions" or change this.   The next four lines contain the name of the NeatImage actions you created.   Here, "none" is a keyword meaning do not run any action.

The three Photoshop actions I use are called NeatImageDefault, NeatImageStrong, and NeatImageNoExif.   The first uses the NI "Default" settings preset.   The second uses the NI "Remove all noise" settings preset.   Both use "Auto match profile" and I have created profiles for each camera at each ISO.   So the difference in the first two actions is how aggressive the settings are, not how the noise profile is selected.

This third action is for images that have no EXIF information or are from a camera that has not been profiled.   This action will tell Neat Image to build a profile from the image itself and apply the default settings.   This will run slower.   And if Neat Image cannot find an area with no texture it will either fail or remove much of the texture in the image.   In other words, the results may be unpredictable.

This is followed by an array of camera models (profiledCameras) that you have prepared NI profiles for.   The square brackets start and end the array.   The models must be in quotes and followed by a comma (except the last one).   The syntax and text case must match exactly.   You can cut and paste these from the Photoshop file info panels with an open image or from the same display in the Bridge.   Images with missing or bad camera data or do not match this profile list will use the noExifNoiseAction.

Next is lowISO and thresholdShutter.   These determine the threshold where the first action (lowNoiseAction) is to be run.   For my own preference I set lowISO to 400 because I find little practical need to adjust these images from my cameras.   Your mileage may vary.   However, it is true that long exposures can produce some noise at any ISO.   So any image exceeding this shutter speed default (1/4s) will use the midNoiseAction instead, even at low ISO settings.

High ISO images generally need more aggressive noise reduction.   The highISO configuration variable determines this threshold.   My own preference is to set this at 1250 because I find that the default action does a good job at anything lower.   Again, YMMV.

The newLayerName variable assigns a name for the noise reduction layer. If this is set to an empty string (""), no layer will be created. Neat Image will process whatever layer is currently selected. The layerOpacity determines the default blending opacity for this layer.

Hints and Tips:

I have tried to implement NI auto match preset with no success.   Every attempt either ends with NI picking the most recently used preset or throwing an exception when run as an action.   It seems to behave differently when the plug-in filter is run from an action than it does when run interactively from the PS filters menu.   YMMV.

Actions do not accommodate conditional tasks very well.   Scripts are very good at conditional tasks, but they require some programming skills.   Photoshop does not offer a scripting interface to filters so we use a combination of a single script and a few actions.

Neat Image uses a concept of profiles and presets.   A profile describes the typical noise characteristics of an image.   A preset describes how aggressively this noise should be scrubbed.   It is important to recognize this difference.   Both will be recorded in the Photoshop action.   Profiles can be matched to a specific camera model and settings based on the metadata in the image.   It is important that you build or obtain these profiles for your equipment before proceeding.   Neat Image provides some usable presets or you can create your own.   See the Neat Image documentation.  

It is extremely important that the recorded actions contain usable options for automation.   Start by recording a new action from the Photoshop actions pallet.   Then run the NeatImage filter against any open image document.   Chose your NI options, apply them, and stop recording.   This will result in a profile option and a preset option recorded in the action as shown below.   This pallet can also be used to load or save action sets with the little arrow at the top right.   This example shows two actions in one action set.

The first two actions have "Auto match profile" recorded.   This comes from selecting "Auto Match Profile" in the Neat Image filter "Actions" menu drop down.   Using the icon buttons and fly-out menus in the image area will not work.   You do not want to use a specific profile or the "Auto Build Profile" or "Auto Fine-Tune Profile" options.   These can load the wrong profile for the image and/or generate messages and errors if the image has no usable non-textured area.   The last action uses "Auto Match Profile".   This is a last resort for the case where the EXIF data is missing or the image did not come from one of your own profiled cameras.

The actionís Preset: option is also determined while you are recording the action.   You do not want RecentPreset to be recorded.   This will result in the automation tasks using the last arbitrary preset you used in an interactive session.   Clearly this will be unpredictable.   Use the NI Noise Filter Settings tab to select a named preset from the Filter Preset fly-out menu.   Naturally, this also allows you to create your own presets and settings.   The Auto Match Preset option under the NI Actions menu is not a good choice.   This will frequently result in using the most recent preset, generating a match failure message, or aborting the filter with a Photoshop exception message.   None of these are desirable in an automation run.

Neat Image provides automatic fine tuning and other exotic options.   These are perfectly appropriate for interactive sessions with a single image at a time.   They are not appropriate for batch processing 50 or 100 images from a sporting event.   Here the intelligent options are simply strong, moderate, or no noise reduction.   One script, two actions, and some noise matching profiles for your cameras will accomplish this.

For maximum flexibility and other automation functions you might want to have a look at the GetFilesFromBridge.   script also available at this site.


This script is provided as shareware with no warranty, but also no usage restrictions.   You are free to use and modify it.   If you feel obliged to pay something, make a contribution to your favorite charity.   It is available at this link in a ZIP file   This is NeatImage.jsx version 1.1.   The ZIP file also contains the NeatImageActions set with the actions I use.   Install this "NeatImagteActions.atn" file in [PSInstall]/presets/Photoshop Actions/:

This script needs to be extracted and installed to [PSInstall]/presets/scripts/.   Whenever new scripts are added here, Photoshop needs to be restarted to enable them.   This script will only run with Photoshop CS.  

If you have any comments, or suggestions, I would welcome your input.   Please send me an  Email.

Rags Gardner
Rags Int., Inc.
204 Trailwood Drive
Euless, TX 76039
(817) 267-2554
Send Email
October 13, 2006

This page last updated on: Wednesday October 03 2007
You are visitor number 15,336 since 10/13/06