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

processapi nameasset typetypedescription
Calculate blurhashblurhashimageasyncGenerates a blurhash of the uploaded image (see Blurhash). The result is added to asset metadata.
Detect whitespacewhitespace-detectimagesync / asyncDetects images which contain large blank regions on the edges. Useful to flag images which might need further processing.
Extract dominant colorsdominant-colorimagesync / asyncAnalyzes the image and returns a palette consisting of the most prominent colors in the image.
Count facesface-countimagesync / asyncReturns 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 AIautotagimageasyncAdd-on Performs automatic tag generation of the images with AI.
Recognize licence platesplate-recognitionimagesync / asyncAdd-on Detects and recognizes car licence plates in the image. The result is included in the file information.
Recognize schemaschema-recognitionimagesync / asyncAdd-on Classifies the image as a photograph vs. schema (diagram, chart, 3d model, blueprint, annotations, etc.).
Remove backgroundremove-backgroundimagesync / asyncAdd-on Removes the background of the image. Useful for product images, portraits, etc.
Recognize textocrimagesync / asyncAdd-on Performs text recognition on the image.
Validate image propertiesimage-propertiesimagesyncPerforms image validation based on media properties upon upload.
Validate video properties video-propertiesvideosyncPerforms video validation based on media properties upon upload
Video transcodetranscodevideoasyncAdd-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.

Photo alt \#responsive

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:

propertyasset typeexamples
Image/Video width (px)images, videosHorizontal image dimensions/frame size in pixels.
Example: Image width (px),is smaller than,500
Image/Video height (px)images, videosVertical image dimensions/frame size in pixels.
Example: Video height (px),is smaller than,200
Image formatimagesImage format.
Example: Image format,is any of,PNG, JPEG
File size (B)images, videoFile size in bytes.
Example: File size (B),is larger than,5000000
Video bitrate (bps)videosVideo bitrate in bps.
Example: Video bitrate (bps),is smaller than,1500000
Video duration (s)videosVideo duration in seconds.
Example: Video duration (s),is largen than,60
Upload folder pathimages, videosUpload 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 taskresult variablesexamples
Detect whitespacePortion of white space horizontally (%)
Portion of white space vertically (%)
Portion of white space horizontally (%),is larger than,40,Notice
Count facesNumber of facesNumber of faces,is smaller than,1,Refuse
Recognize licence platesNumber of characters in licence plate
Licence plate content
Licence plate content,does not start with,C,Notice
Recognize schemaProbability of schema (%)
Probability of photograpthic (%)
Probability of watermark (%)
Probability of watermark (%),is larger than,70,Refuse
Recognize textTextText,contains,Copyright,Refuse
Validate image propertiesImage/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 propertiesImage/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