AutoTask Repurpose

For an overview of AutoTasks and their syntax, see AutoTasks

Image assets can be repurposed via Autotask. When triggered via Autotask, the repurposing process will create a new derivative file using chosen parameters that must be exported. There are two ways to perform a repurpose operation via AutoTask: by using a pre-saved preset or manually configuring repurpose parameters in the AutoTask itself.

If the AutoTask includes a repurpose action but does not explicitly specify an export action, the task will fail.

Repurpose presets

Repurpose operations can be saved as presets, and these presets may be used as an AutoTask parameter.

Parameter Description

presetProcess

After an administrator has created and saved a set of repurpose operations as a preset, the name of the preset can be used as a value for this parameter. When the match criteria of the task is triggered, the task will repurpose any affected assets according to its preset.

Value: Name of an existing preset

In the following example, the task will trigger when an asset is uploaded to NetX with the value Yes applied to the attribute Grayscale. When triggered, the task will exportview to attach to the newly uploaded asset called Grayscale view with all preset repurpose operations applied. 

<task>
	<matchCriteria type="and">
    	<criteria type="action" value="import"/>
    	<criteria name="Grayscale" type="attribute" value="Yes"/>
	</matchCriteria>
	<repurpose presetProcess="Grayscale converted"/>
	<exports>
        <export name="Grayscale view" type="view"/>
    </exports>
</task>

Repurpose parameters

While both height and width parameters may be used in the same AutoTask, combining these parameters will not crop the image – only one of these parameters will apply to any affected asset. If both parameters are included, the task will proportionally scale according to the parameter that applies to the shortest side. That is to say, a portrait-oriented image will apply the width parameter's pixel count, then adjust the length of the image proportionally. Conversely, a landscape-oriented image will use the height parameter to adjust the width of the image proportionally.

Some repurpose operations may be used directly as AutoTask parameters, rather than tying a parameter to a preset. The following are supported as repurpose parameters:

Parameter Description

watermarkAssetId

To add a watermark during the repurpose process, use the unique asset ID of the asset being used as a watermark; if you are uncertain about the asset ID for the asset you are using, check its detail page. Note that this watermark file must already exist in the application, and must be a .png file type if you would like to adjust the watermark's opacity setting. This criterion is required for any AutoTask which applies a watermark in any context. 

Value options: Numerical asset ID

watermarkAlpha

This parameter's value adjusts the opacity of the watermark as it is applied to your assets. Your value will be between 2-100, with 100 being completely opaque and 2 completely transparent.

Value options: 2-100

watermarkPosition

The value of this parameter assigns a position to the watermark as it will appear on the affected assets or views. If this parameter is absent or is not set to a valid value, your watermark will default to overlay. Note that these values are case-sensitive.

Value options: 

  • topLeft
  • topCenter
  • topRight
  • middleLeft
  • middleCenter
  • middleRight
  • bottomLeft
  • bottomCenter
  • bottomRight
  • overlay

watermarkFit

If this parameter's value is true, the watermark image will automatically resize to fit within the watermark's position parameters (if any). Note that images are never stretched to fit a placement selection, but will shrink to fit into a placement parameter.

Value options: true / false

watermarkThumbnail

If this parameter is true, the named watermark will apply to the affected assets' thumbnails. Asset previews will be watermarked by default. 

Value options: true / false

format

The value of this parameter will determine the file format of the repurposed asset. Affected assets that are already in the format specified will not be converted.

Value options: jpg / tiff / png / gif

height

The value of this parameter defines the height, in pixels, of the exported asset. Repurposed assets will not be stretched, i.e. if the asset being repurposed is shorter than the height value, this parameter will not apply to the asset.

Note that using height as a parameter in conjunction with width is not recommended; if you would like to define the desired longest side of any given repurposed asset, use the length parameter instead. 

Value options: Number, in pixels

length

The value of this parameter defines the final longest side, in pixels, of the exported asset. Repurposed assets will not be stretched, i.e. if the asset's width and height do not exceed the value of this parameter, it will not apply to the asset.

Note that if this parameter is set, neither height nor width should be used in the same AutoTask. 

Value options: Number, in pixels

width

The value of this parameter defines the width, in pixels, of the exported asset. Repurposed assets will not be stretched, i.e. if the asset being repurposed is shorter than the width value, this parameter will not apply to the asset. 

Note that using width as a parameter in conjunction with height is not recommended; if you would like to define the desired longest side of any given repurposed asset, use the length parameter instead. 

Value options: Number, in pixels

In the following example, resynced image assets will be repurposed into jpg file format, with their width adjusted to 800 pixels, and the asset corresponding to the asset ID 733 applied to the top left of the image as a watermark. This repurposed file will then be exported as a view. The length of the resulting image will scale proportionally according to the new width. 

<task>
	<matchCriteria type="and">
    	<criteria type="action" value="resync"/>
	</matchCriteria>
	<repurpose format="jpg" width="800" watermarkAssetId="733" watermarkPosition="topLeft"/>
	<exports>
        <export name="Resized watermark view" type="view"/>
    </exports>
</task>

background and extent

Combining background and extent forces specific dimensions on any affected asset, even adding padding to any image whose length or width is shorter than the specified dimension.

Parameter Description

extent

The extent values determine the minimum length and width an affected asset's export will be sized at. If the image needs to be resized, it will be resized proportionally according to its shortest side. 

Value options: Two numbers, in pixels, delimited with a comma

background

If the size of the image in question is smaller than the extent dimensions along either side, the remainder of the space will be filled with white padding. 

Value options: white

 

The following AutoTask example triggers when an image asset is uploaded. The repurpose derivative will be sized to 600x800 pixels; any image smaller than 600x800 will be padded to achieve those dimensions with a white background. It will then be exported as a view

<task>
	<matchCriteria type="and">
    	<criteria type="action" value="import"/>
  	</matchCriteria>
  	<repurpose background="white" extent="600,800"/>
  	<exports>
    	<export name="Image with Background" type="view"/>
  	</exports>
</task>
Was this article helpful?
0 out of 0 found this helpful