Image - Filter

Declaration

Related Topics

Description

Applies a filter to an image in order to change its appearance.

Practical Usage

Used to insert a filter in order to enhance, modify or warp an image. Filters can be used to increase brightness and contrast as well as to add a wide variety of special effects to an image.

Parameters

General

Property Type Required Default Markup Description
Source Text Yes (Empty) SOURCEIMAGE="c:\temp\sourceImage.jpg" The path and file name of the source image to apply a filter to. Supported image formats are JPG, JPEG, PNG, BMP, TIF, TIFF, and GIF. This can be a fully qualified path and file name (preferred) or a single file (requires use of the File System - Change folder activity). Wildcard characters (for example, * or ?) may be used to specify all files matching a certain mask. Multiple files and/or file masks can be specified by separating each entry with a pipe character (|) (for example, c:\temp\*.txt|c:\backup\*.bak). See File Masks & Wildcards for more details.  
Destination Text Yes Empty DESTINATIONIMAGE="c:\temp\DestImage.jpg" The path and file name of the destination image. This allows you to save your file under a new path, name and/or type to avoid overwriting the source (original) file. To overwrite the source file, enter its original path and file name.
NOTE: If performing an overwrite, make sure to set the Overwrite if exists parameter to YES (enabled) in the File Options properties. This will allow matching files found in the destination folder to be overwritten.
Filter type Text (options) Yes Grayscale
  • FILTERTYPE="invert"
  • FILTERTYPE="sharpen"
  • FILTERTYPE="smooth"
  • FILTERTYPE="gaussian_blur"
  • FILTERTYPE="mean_removal"
  • FILTERTYPE="emboss"
The type of filter to apply. The available options are:
  • Grayscale (default) - Also known as "black and white." Composed exclusively of shades varying from black at the weakest intensity to white at the strongest.
  • Invert - Inverts colors in an image.
  • Sharpness - Describes the clarity of detail in an image.
  • Smoothness - A filter used to reduce noise within an image or to produce a less pixelated image.
  • Gaussian blur - A filter commonly used to blur an image, typically to reduce noise and detail.
  • Mean removal - Removes the mean values of compressed image. This filter usually achieves a "sketchy" effect.
  • Emboss - A technique in which each pixel of an image is replaced either by a highlight or a shadow, depending on light/dark boundaries on the original image.
Invert alpha Yes/No Yes, if the Filter type parameter is set to Invert No INVERTALPHA="YES" If selected, converts all channels to the value of the alpha channel for the original pixel. Alpha channel is a portion of each pixel's data that is reserved for transparency information. This parameter is active only if the Filter type parameter is set to Invert.
Sharpness Number Yes, if the Filter type parameter is set to Sharpness 0 SHARPNESS="25" The sharpness level to apply. Adjust the slider from 0-100 or enter a value in the provided text box. This parameter is active only if the Filter type parameter is set to Sharpness.
Smoothness Number Yes, if the Filter type parameter is set to Smoothness 0 SMOOTHNESS="75" The smoothness level to apply. Adjust the slider from 0-100 or enter a value in the provided text box. This parameter is active only if the Filter type parameter is set to Smoothness.

Advanced

Property Type Required Default Markup Description
Create and populate dataset Text No (Empty) DATASET="datasetName" The name of a dataset to create and populate with information about this activity's results. For more details, see Datasets below.

File Options

Property Type Required Default Markup Description
Exclude mask Text No (Empty)
  • EXCLUDE="*.txt"
  • EXCLUDE="*.txt|*.bak
  • EXCLUDE="c:\foldename"
Causes this action to omit files matching the masks specified. File names or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe (|) symbol (for example, *.txt|*.bak).
Regular expression Yes/No No No RE="YES" Specifies whether the Exclude mask parameter is a regular expression. If disabled (default), the Exclude mask parameter contains literal text.
Only if newer than Date No (Empty) ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" If enabled, causes this action to only act on files that are newer than the date/time specified. If this parameter is left blank or disabled (default), file 'newer than' dates are ignored. Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.
Only if older than Date No (Empty) ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" If enabled, causes this action to only act on files that are older than the date/time specified. If this parameter is left blank or disabled (default), file 'older than' dates are ignored. Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.
Overwrite if exists Yes/No No No OVERWRITE="YES" If selected, indicates that, if files with matching names already exists in the destination, they will be overwritten. If disabled (default), files with matching names will not be overwritten, however, an error will occur during runtime stating a file with the same name already exists.
Only if newer Yes/No No No ISNEWER="YES" If selected, indicates that, if files with matching names already exists in the destination, only source files that are newer will overwrite existing files. If disabled (default), all matching files found in the destination folder will be overwritten regardless of their date properties. This parameter is active only if the Overwrite if Exists parameter is selected.
Only if exists in destination Yes/No No No ONLYIFEXIST="YES" If selected, only files that already exist in the destination will be copied from the source. All other files, regardless of whether they match the mask or other parameter settings will be bypassed. This parameter is disabled by default and becomes active only if the Overwrite if Exist parameter is selected.
Overwrite read-only files Yes/No No No OVERWRITEREADONLY="YES" If selected, matching files found in the destination folder will be overwritten even if they are marked with the read-only attribute. If disabled (default), read-only files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is selected.
Overwrite hidden files Yes/No No No OVERWRITEHIDDEN="YES" If selected, matching files found in the destination folder will be overwritten even if they are marked with the hidden attribute. If disabled (default), hidden files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is selected.
Include subfolders Yes/No No No SUBFOLDERS="YES" If selected, denotes that, if present, subfolders should be searched for files matching the mask specified in the Source parameter. If disabled (default), subfolders are ignored. Only files that exist in the root of the source folder will be searched.
Preserve folder structure Yes/No No No KEEPFOLDERSTRUCT="NO" If selected, subfolders found in the source folder will be created in the destination folder and source files will be copied into their respective folders. If disabled (default), subfolders will not be created in the destination. Instead, source files that exist in these subfolders will be copied into the root of the destination folder. This parameter is active only if the Include subfolders parameter is selected.
Turn archive attribute off Yes/No No No ARCHIVETURNOFF="YES" If selected, specifies that the archive attribute of the source files should be switched OFF. The Windows archive attribute is generally used to track whether a file has been backed-up. Turning the source file's archive attribute off indicates to many backup programs that the file has already been backed-up. This parameter is disabled by default.
Match case Yes/No No No MATCHCASE="YES" If selected (default), the activity becomes case sensitive. If disabled, the activity becomes case insensitive, whereas, it does not distinguish between uppercase and lowercase characters.

File Attributes

Property Type Required Default Markup Description
Attributes Text (Options) No (Empty)
  • ATTRFILTER="+R+A-H" (read-only & archive files will be affected but not hidden files)
  • ATTRFILTER="-S+H+E" (hidden and encrypted files will be affected but not system files)
Instructs the activity to filter which files it should act on based on whether the file's original attribute settings match the attribute settings specified in this parameter. For example, if the Read-only attribute is set to Off (in visual mode) or "-R" (in AML mode) , only source files with the Read-only attribute turned off will be affected. Source files with Read-only turned on will be ignored. In visual mode, a group of controls are provided to assist in the selection of attribute settings. In AML mode, a single text item must be entered that contains the original attribute mask of the files you wish to affect. Available Options are:
  • R—Read-only - Specifying On or "+R" causes files with this attribute turned on to be included. Specifying Off or "-R" causes files with this attribute turned off to be included. Specifying Doesn't matter or excluding the letter (default) causes this attribute to be ignored.
  • A—Archive - Specifying On or "+A" causes files with this attribute turned on to be included. Specifying Off or "-A" causes files with this attribute turned off to be included. Specifying Doesn't matter or excluding the letter (default) causes this attribute to be ignored.

  • S—System - Specifying On or "+S" causes files with this attribute turned on to be included. Specifying Off or "-S" causes files with this attribute turned off to be included. Specifying Doesn't matter or excluding the letter (default) causes this attribute to be ignored.

  • H—Hidden - Specifying On or "+H" causes files with this attribute turned on to be included. Specifying Off or "-H" causes files with this attribute turned off to be included. Specifying Doesn't matter or excluding the letter (default) causes this attribute to be ignored.

  • C—Compression - Specifying On or "+C" causes files with this attribute turned on to be included. Specifying Off or "-C" causes files with this attribute turned off to be included. Specifying Doesn't matter or excluding the letter (default) causes this attribute to be ignored.

  • E-Encrypted - Specifying On or "+E" causes files with this attribute turned on to be included. Specifying Off or "-E" causes files with this attribute turned off to be included. Specifying Doesn't matter or excluding the letter (default) causes this attribute to be ignored.

Description

Error Causes

On Error

Additional Notes

Datasets

A dataset is a multi-column, multi-row object that contains a collection of data gathered during execution of an activity and stored in memory. This activity creates and populates a dataset with the following rows:

Name Type Return Value
theDataset.Destination Text The path and file name of the output file.
theDataset.Message Number If theDataset.Result returns 1, this field returns a description of the error that occurred. If theDataset.Result returns 0, this field is left blank.
theDataset.Result Number The runtime result of this activity. If 0 is returned, this activity ran successfully. If 1 is returned, this activity failed with an error.
theDataset.Source Text The path and file name of the source (original) file.

Example

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Description

This sample task applies the GrayScale filter to an image and then saves it as a new file name.

Copy
<AMIMAGE ACTIVITY="filter" MATCHCASE="YES" OVERWRITE="YES" ISNEWER="YES" SOURCEIMAGE="C:\temp\am_128.png" DATASET="theDataset" DESTINATIONIMAGE="C:\temp2\am_128.bmp" />