How to apply Image Enhancement Profile based on the file path?


How to apply an Image Enhancement Profile based on the file path?


When multiple image enhancement profiles are present to handle several types of documents, it can be necessary to apply them based on a certain condition, e.g., the file source path. 

The image enhancement profile can be applied to an image based on the file path name of the image in the custom script stage. Additionally, if there is a specific naming convention for the files, you may use RegExp to specify templates along with conditions in order to apply the profile for specific files only. 

To check the document's source, please use two properties of the document: ImageSourceFileSubPath and ImageSource.

Name Type Access Description
ImageSource* string Read-only The source of an image. If the image was imported from a file, this property will contain the path to the file. If the image was received from a scanner, ImageSource will contain the name of the source. Contains an empty value if the image was imported using a custom import.
ImageSourceFileSubPath*  string Read-only The path of the source image relative to the root of Hot Folder or the folder they were imported from.

To apply an Image Enhancement Profile based on the file path, please perform the following steps:

  1. Create an Automatic (Script) stage and place it after the Scanning stage.
  2. Click Edit…
  3. Select Document processing as a Type and click Edit script…
  4. Paste the following code and make necessary changes to it:
IPages pages = Document.Pages; 
foreach (IPage page in pages){
//Show file's ImageSourceFileSubPath and ImageSource paths
FCTools.ShowMessage("ImageSourceFileSubPath " +(page.ImageSourcePageNumber).ToString()+" : " +(page.ImageSourceFileSubPath).ToString());
FCTools.ShowMessage("ImageSource " +(page.ImageSourcePageNumber).ToString()+" : " +(page.ImageSource).ToString());

//Obtain the ImageSource path
string imageSource = (page.ImageSource).ToString();
string keyword = "image";
bool sourceContainsKeyword = imageSource.Contains(keyword);

FCTools.ShowMessage(keyword + " is in the string " + imageSource + " : " + b);

// Applying the profile only if the file path includes word "image"
//Specify the profile name in the brackets

As a result, you will apply the import profile based on the path condition and get the path of the source image relative to the root and the source of an image. The difference is shown in the image below. 

Additional information:


Image Enhancement Profiles

How to change Image Enhancement Profile at import time?

Have more questions? Submit a request



Please sign in to leave a comment.