Post processing
The post process capability allows you to trigger different tasks upon asset upload. This may be done either synchronously or asynchronously. Async processes allow you to avoid waiting for the process to finish while uploading while the sync setting gives you a mechanism to validate assets based on pre-defined criteria.
Available postprocess tasks
process | api name | asset type | type | description |
---|---|---|---|---|
Calculate blurhash | blurhash | image | async | Generates a blurhash of the uploaded image (see Blurhash). The result is added to asset metadata. |
Detect whitespace | whitespace-detect | image | sync / async | Detects images which contain large blank regions on the edges. Useful to flag images which might need further processing. |
Extract dominant colors | dominant-color | image | sync / async | Analyzes the image and returns a palette consisting of the most prominent colors in the image. |
Count faces | face-count | image | sync / async | Returns the number of faces detected in the image. Can be used for classification or to ensure the presence or absence of faces upon upload. |
Tag with AI | autotag | image | async | Add-on Performs automatic tag generation of the images with AI. |
Recognize brands and logos | brand-detect | image | async | Add-on Uses AI to detect the presence of logos from a database containing thousand of popular brands. The list of recognized brands is included in the file information. |
Recognize licence plates | plate-recognition | image | sync / async | Add-on Detects and recognizes car licence plates in the image. The result is included in the file information. |
Recognize schema | schema-recognition | image | sync / async | Add-on Classifies the image as a photograph vs. schema (diagram, chart, 3d model, blueprint, annotations, etc.). |
Remove background | remove-background | image | sync / async | Add-on Removes the background of the image. Useful for product images, portraits, etc. |
Recognize text | ocr | image | sync / async | Add-on Performs text recognition on the image. |
Validate image properties | image-properties | image | sync | Performs image validation based on media properties upon upload. |
Validate video properties | video-properties | video | sync | Performs video validation based on media properties upon upload |
Video transcode | transcode | video | async | Add-on Enqueues a video transcoding task (see Video transcoding) for the uploaded video. |
Settings
You can access the postprocess settings from Developers / Automations / Post processing.
All uploads setting
When a postprocess automation task is enabled, the task will be run automatically on each upload. If not enabled, you can trigger it for certain uploads via API using the postprocess parameter (eg. postprocess=remove-background
in the Upload API call). Please note that trigger rules are evaluated in both cases.
Trigger rules
In this field, you can write conditions which must be met in order to activate the relatedtask. If empty, the postprocess automation task will be run on each upload.
Valid variables for trigger rules are:
property | asset type | examples |
---|---|---|
Image/Video width (px) | images, videos | Horizontal image dimensions/frame size in pixels. Example: Image width (px) ,is smaller than ,500 |
Image/Video height (px) | images, videos | Vertical image dimensions/frame size in pixels. Example: Video height (px) ,is smaller than ,200 |
Image format | images | Image format. Example: Image format ,is any of ,PNG, JPEG |
File size (B) | images, video | File size in bytes. Example: File size (B) ,is larger than ,5000000 |
Video bitrate (bps) | videos | Video bitrate in bps. Example: Video bitrate (bps) ,is smaller than ,1500000 |
Video duration (s) | videos | Video duration in seconds. Example: Video duration (s) ,is largen than ,60 |
Upload folder path | images, videos | Upload path in container. Example: Upload folder path ,starts with ,/users |
Validation rules
The synchronous tasks can be used to validate uploads using validation rules. Possible actions when conditions have been met are Refuse
(the upload is rejected) and Notice
(issues a notice which is added to the file information and is returned in the API response).
Please note that setting up too many synchronous tasks might slow down the upload process significantly.
postprocess task | result variables | examples |
---|---|---|
Detect whitespace | Portion of white space horizontally (%) Portion of white space vertically (%) | Portion of white space horizontally (%) ,is larger than ,40 ,Notice |
Count faces | Number of faces | Number of faces ,is smaller than ,1 ,Refuse |
Recognize licence plates | Number of characters in licence plate Licence plate content | Licence plate content ,does not start with ,C ,Notice |
Recognize schema | Probability of schema (%) Probability of photograpthic (%) Probability of watermark (%) | Probability of watermark (%) ,is larger than ,70 ,Refuse |
Recognize text | Text | Text ,contains ,Copyright ,Refuse |
Validate image properties | Image/Video width (px) Image/Video height (px) Image format File size (B) Upload folder path | Image width (px) ,is smaller than ,500 ,Notice |
Validate video properties | Image/Video width (px) Image/Video height (px) File size (B) Video bitrate (bps) Video duration (s) Upload folder path | Video bitrate (bps) ,is smaller than ,800000 ,Refuse |