Image - Resize

Declaration

<AMIMAGE SOURCEIMAGE="text" RESIZETYPE="text (options)" 
DATASET="text" WIDTH="number" HIGHT="number" 
DESTINATIONIMAGE="text" SUBFOLDERS="YES/NO" 
KEEPFOLDERSTRUCT="YES/NO" OVERWRITE="YES/NO" 
ISNEWER="YES/NO" ONLYIFEXIST="YES/NO" 
OVERWRITEREADONLY="YES/NO" 
OVERWRITEHIDDEN="YES/NO" ARCHIVETURNOFF="YES/NO" 
EXCLUDE="text" RE="YES/NO" />

Description: Re-sizes an image by a percentage of the original image size, by the specified height/width dimensions (in pixels) or to a precise file size.

Practical Usage

Commonly used to re-size a large image to a more manageable size in order for it to fit better on a web page or share it via e-mail. Can also be used together with the Loop activities to re-size a batch of images. Note that If the image isn't already a JPEG, you can usually save a significant amount of space by converting the file to JPEG using the Convert activity.

General Parameters

Property

Type

Required

Default

Markup

Description

Source

Text

Yes

(Empty)

SOURCEIMAGE=

"c:\temp\source.jpg"

The path and file name of the source image to re-size. Supported image formats are JPEG, PNG, BMP, TIFF and GIF.

Destination

Text

Yes

(Empty)

DESTINATIONIMAGE=

"c:\temp\dest.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.

Resize to

Text (options)

No

Percentage

  1. RESIZETYPE="dimension"

  2. RESIZETYPE="percentage"

  3. RESIZETYPE="file_size"

Dimensions - The image will be re-sized by the width and height (in pixels) specified.

  • File size - The image will be re-sized to match the file size (in KB) specified.

  • Width

    Number

    Yes if Resize is set to Dimensions

    (Empty)

    WIDTH="150"

    The total width measured in pixels in which to re-size the image. This parameter is active only if the Resize to parameter is set to Dimensions.

    Height

    Number

    Yes if Resize is set to Dimensions

    (Empty)

    HEIGHT="330"

    The total height measured in pixels in which to re-size the image. This parameter is active only if the  Resize to parameter is set to Dimensions.

    Percentage

    Number

    Yes if Resize is set to Percentage

    (Empty)

    PERCENTAGE="40"

    The percentage amount of the original size in which to re-size the image (e.g., 50=50% of the original size). This parameter is active only if the  Resize to parameter is set to Percentage.

    Size

    Number

    Yes if Resize is set to File size

    (Empty)

    FILESIZE="120"

    The value measured in pixels in which to re-size the image (e.g., 120=120 pixels). This parameter is active only if the  Resize to parameter is set to File size.

    Advanced Parameters

    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 relevant to this activity. For more details, see Datasets below.

    File Options Parameters

    Property

    Type

    Required

    Default

    Markup

    Description

    Include sub-folders

    Yes/No

    No

    No

    SUBFOLDERS="YES"

    If set to YES, denotes that, if present, sub-folders should be searched for files matching the mask specified in the Source parameter. If set to NO (default), sub-folders are ignored. Only files that exist in the root of the source folder will be searched.

    Preserve folder structure

    Yes/No

    No

    Yes

    KEEPFOLDERSTRUCT="NO"

    If set to YES (default), sub-folders found in the source folder will be created in the destination folder and source files will be copied into their respective folders. If set to NO, sub-folders will not be created. Files that exist in these sub-folders will be copied into the root of the source folder instead. This parameter is active only if the Include Sub-folders parameter is set to YES.

    Include empty sub-folders

    Yes/No

    No

    No

    EMPTYFOLDERS="YES"

    If set to YES, sub-folders found in the source folder will be created in the destination folder even if they do not contain any files. If set to NO (default), empty sub-folders are ignored. This parameter is active only if the Include Sub-folders parameter is set to YES.

    Only folder structure

    Yes/No

    No

    No

    ONLYFOLDERSTRUCT="YES"

    If set to YES, sub-folders found in the source folder will be created in the destination folder but files that reside in these sub-folders will not be copied. This parameter is set to NO by default and is active only if the Include Sub-folders parameter is set to YES.

    Note: Setting this parameter to YES causes all other folder-specific parameters to be ignored.

    Overwrite if Exist

    Yes/No

    No

    No

    OVERWRITE="YES"

    If set to YES, matching files found in the destination folder are to be overwritten. If set to NO (default), an error will occur as a result of a matching file found.

    Only if Newer

    Yes/No

    No

    No

    ISNEWER="YES"

    If set to YES, only source files that are newer than those that match in the destination are to be overwritten folder will overwrite existing files. If set to NO (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 set to YES.

    Only if exist in destination

    Yes/No

    No

    No

    ONLYIFEXIST="YES"

    If set to YES, only files that already exist in the destination folder will be copied from the source folder. All other files, regardless of whether they match the mask or other parameter settings will be bypassed. This parameter is set to NO by default and becomes active only if the Overwrite if Exist parameter is set to YES.

    Overwrite read-only files

    Yes/No

    No

    No

    OVERWRITEREADONLY="YES"

    If set to YES, matching files found in the destination folder will be overwritten even if they are marked with the read-only attribute. If set to NO (default), read-only files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is set to YES.

    Overwrite hidden files

    Yes/No

    No

    No

    OVERWRITEHIDDEN="YES"

    If set to YES, matching files found in the destination folder will be overwritten even if they are marked with the hidden attribute. If set to NO (default), hidden files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is set to YES.

    Turn archive attribute off

    Yes/No

    No

    No

    ARCHIVETURNOFF="YES"

    If set to YES, archive attribute of the source files will 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 set to NO by default.

    Exclude mask

    Text

    No

    (Empty)

    EXCLUDE="*.txt"

    Causes this action to omit files matching the mask(s) 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

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

    File Filter Parameters

    Property

    Type

    Required

    Default

    Markup

    Description

    Attributes

    Text (Options)

    No

    (Empty)

    1. ATTRFILTER="+R+A-H" (read-only & archive files will be affected but not hidden files)

    2. 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 tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

    Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

    On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

    Datasets

    A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset with the following fields (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. If1 is returned, this activity failed with an error.

    theDataset.Source

    Text

    The path and file name of the source (original) file.

    Example

    The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

    Description: Set properties of Active Directory object at ""LDAP://OU=MyCompany,DC=mycompany,DC=com"" and create and populate dataset "theDataset" with the properties.

    <AMCREATEADPROPERTYDATASET LDAPPATH="&quot;
    LDAP://OU=MyCompany,DC=mycompany,DC=com&quot;" 
    USERNAME="theUserName" PASSWORD="AM2PBmOg3vfcdsoGZuDe99x2" 
    RESULTDATASET="theDataset" />