Generating Watermarked Views with AutoTask

If you want to generate a watermarked copy of an asset, you can use an AutoTask to create a secondary, watermarked view when assets meeting certain criteria are uploaded to NetX. These watermarks may be applied to image and video file formats. 

The AutoTask

<task name="Watermark View">
    <matchCriteria type="and">
        <criteria type="action" value="import"/>
        <criteria name="fileType" type="attribute" value="(jpg|png|tiff|psd)"/>
		<criteria name="Watermark" type="attribute" value="Yes"/>
    </matchCriteria>
	<repurpose format="jpg" length="800" watermarkAlpha="0.4" watermarkAssetId="667" watermarkPosition="bottomRight"/>
   <exports>
        <export name="Low-res version" type="view"/>
   </exports>
</task>

Breaking it down

matchCriteria

The matchCriteria value is and, meaning in order to trigger the AutoTask all criteria must be met. If your matchCriteria is configured with an or value, the AutoTask will trigger if any of the named criteria are met.

criteria

  • The action to trigger the AutoTask is, in this case, import – i.e. an upload action. 
  • The second criteria specifies that the task applies to assets uploaded with a fileType attribute value of JPG, PNG, TIFF, or PSD. This means the task will trigger only when a JPG, PNG, TIFF, or PSD file is uploaded to NetX.
  • The third criteria uses the custom attribute Watermark to further specify the AutoTask should only trigger when a matching file type is imported with a Watermark attribute value of Yes

This criteria can be adjusted to fit your organization's specific workflow and needs. For example, changing the triggering action to resync and the attribute value criteria to MP4 will trigger the task when an MP4 video file is resynced. 

repurpose

Once all of the AutoTask's criteria have been met, an action must be enumerated; for this AutoTask, that action is repurpose. Repurposing an asset via AutoTask uses the same repurpose operations available in the application, and these operations will apply to all assets that trigger the AutoTask's criteria. In this example:

  • format: Specifies the new view's file format, e.g. a value of JPG will mean the view's file format will always be a JPG file regardless of the original asset's file format.
  • length: Length defines the dimension of the longest side of the outputted view file, and adjusts the original asset's dimensions proportionally. This value is in pixels.
  • watermarkAlpha: Defines the level of transparency applied to the watermark image. This value is a percentage, represented as a whole number between 0 (transparent) and 100 (opaque). Note that the specified watermark image must be a file type that can have a transparency value such as a PNG; image types such as JPG cannot be altered to be more or less transparent with this parameter.
  • >watermarkAssetId: The value of this parameter must be a valid asset ID of an existing NetX asset. This is the asset that will be used as the watermark for all assets affected by this AutoTask. 
  • watermarkPosition: Indicates the placement of the watermark when it is applied to a view. The options are: topLeft, topCenter, topRight, middleLeft, middleCenter, middleRight, bottomLeft, bottomCenter, bottomRight, and overlay. If no watermark position is set, the default is overlay

exports

The exports parameter defines what is done with the repurposed file once the AutoTask has been triggered. 

  • name: The name of the view as it appears on an asset's detail page as well as the name of the file when the view is downloaded from NetX. This name value will apply to all affected assets' view outputs when this AutoTask is applied. 
  • type: The export's type specifies that this finished, repurposed file will be attached to its original asset as a view. 

The result

As shown in the image below, a view named "Watermarked version" has been attached to the asset and is visible via the Views tab on the asset detail page.

Was this article helpful?
0 out of 0 found this helpful