# Post processing

Post processing settings can be accessed from the *Settings > Library >  Automations > Post processing (tab)* menu.

{% hint style="info" %}
Remember that post-processes marked with a \* require Visual AI credits.
{% endhint %}

<figure><img src="https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FgRagsIv7yzoRvC4QlBWW%2Fpost%20processes.png?alt=media&#x26;token=f15ae445-4ecc-40ad-a41d-36ef794c41b9" alt=""><figcaption></figcaption></figure>

When a post process automation task is activated, it will run automatically on each upload. If not activated, the task can be manually triggered for certain uploads via the Upload API using the *postprocess* parameter (e.g., `postprocess=remove-background`).

## Post process parameters

Once a post process is selected, the user is requested to set the following parameters:<br>

<table><thead><tr><th width="272">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>Mode</code></td><td>Sets if the post processing is SYNC (synchronous, -during the upload- preventing the asset to actually be stored while it's analysed) or ASYNC (asynchronous, meaning that the analysis job will be queued, allowing for the asset to immediately be available in the library)</td></tr><tr><td><code>Run on every upload</code></td><td>When enabled, the post process will apply to every upload, if activated and triggers don't prevent it. When disabled, it allows you to prepare, test parameters, and temporarily put on hold the post-process while not losing the configuration.</td></tr><tr><td><code>Trigger rules</code></td><td>Defines conditions under which the post processing will be triggered. If "no trigger rules" is selected, the post processing will trigger with every upload, if activated and enabled.</td></tr><tr><td><code>Validation rules </code><em><code>(optional)</code></em></td><td>Some post-process running in sync mode allow to determine attributes for a file that can be used to decide whether or not to take a predetermined validation action at upload (eg. <em>Notice</em> or <em>Refuse</em> the upload)</td></tr></tbody></table>

### Trigger rules

When setting up a post-process, trigger rules can be specified. These rules specify conditions that must be met to activate the related task. If left empty, the task will be run on each upload.

{% hint style="info" %}
Trigger rules are evaluated to determine whether the task is run manually or automatically.
{% endhint %}

The following variables may be used to construct rules:

<table><thead><tr><th>Property</th><th width="157">Asset type</th><th width="165">Description</th><th>Example</th></tr></thead><tbody><tr><td><strong>Image/Video width (px)</strong></td><td>images / videos</td><td>Horizontal image dimensions / frame size (in pixels).</td><td><em><code>Image width (px) is smaller than 500</code></em></td></tr><tr><td><strong>Image/Video height (px)</strong></td><td>images / videos</td><td>Vertical image dimensions / frame size (in pixels).</td><td><em><code>Video height (px) is larger or equal than 200</code></em></td></tr><tr><td><strong>Image format</strong></td><td>images</td><td>The file type of the image.</td><td><em><code>Image format contains PNG, JPEG</code></em></td></tr><tr><td><strong>File size (B)</strong></td><td>images / videos</td><td>The size of the asset in bytes.</td><td><em><code>File size (B) is larger than 5000000</code></em></td></tr><tr><td><strong>Video bitrate (bps)</strong></td><td>videos</td><td>The video bitrate in bits per second.</td><td><em><code>Video bitrate (bps) is smaller than 1500000</code></em></td></tr><tr><td><strong>Video duration (s)</strong></td><td>videos</td><td>The video duration in seconds.</td><td><em><code>Video duration (s) is larger than 60</code></em></td></tr><tr><td><strong>Upload folder path</strong></td><td>images / videos</td><td>The location in which the asset is getting uploaded.</td><td><em><code>Upload folder path starts with '/users'</code></em></td></tr></tbody></table>

### Validation rules

As mentioned, the synchronous tasks provide a mechanism to validate uploads using validation rules. Possible actions when conditions have been met are:

* **Refuse** - The upload is rejected.
* **Notice** - A notice is issued, added to the file information and returned in the API response.

{% hint style="warning" %}
Setting up many synchronous tasks might significantly slow down the upload process.
{% endhint %}

<table><thead><tr><th width="221">Process</th><th>Validation rule</th><th>Example</th></tr></thead><tbody><tr><td><strong>Count faces</strong></td><td><ul><li>Number of faces</li></ul></td><td><em><code>Number of faces is smaller than 1 => Refuse</code></em></td></tr><tr><td><strong>Not Safe For Work</strong></td><td><ul><li>NSFW</li><li>Drawing</li><li>Hentai</li><li>Neutral</li><li>Porn</li></ul></td><td><em><code>NSFW is larger than 0.70 => Refuse</code></em></td></tr><tr><td><strong>Recognize number plate</strong></td><td><ul><li>Number of characters in number plate</li><li>Number plate content</li></ul></td><td><em><code>Number plate content does not start with 'C' => Notice</code></em></td></tr><tr><td><strong>Recognize text (OCR)</strong></td><td><ul><li>Text contains</li></ul></td><td><em><code>Text contains 'Copyright' => Refuse</code></em></td></tr><tr><td><strong>Validate image properties</strong></td><td><ul><li>Image/Video width (px)</li><li>Image/Video height (px)</li><li>Image format</li><li>File size (B)</li><li>Upload folder path</li></ul></td><td><em><code>Image width (px) is smaller than 500 => Notice</code></em></td></tr><tr><td><strong>Validate video properties</strong></td><td><ul><li>Image/Video width (px)</li><li>Image/Video height (px)</li><li>File size (B)</li><li>Video bitrate (bps)</li><li>Video duration (s)</li><li>Upload folder path</li></ul></td><td><em><code>Video bitrate (bps) is smaller than 800000 => Refuse</code></em></td></tr></tbody></table>

### **Availability**

Please note that when marked "Unavailable", a post-process will not run and first it needs to be activated. That happens with a request to our [Support Team](https://scaleflex.zendesk.com/hc/en-gb), and in the meantime, triggering will be prevented regardless of the configuration of the post-process.

When the activation is provided and your account has enough Visual AI credits to run it, the post-process will be applied to all uploads, if the "Run on every upload" option is set to "Enabled".

### Post process list

Refer to the Upload post-processes on the [Automation page](https://docs.scaleflex.com/digital-asset-management-dam/settings/automations/..#post-processing-tasks) for a list of available post-processes.
