Image Processor settings
Look up the interfaces that turn Image Processor on, the rule behaviors it adds, the cache fields it varies, and the data it reports.
Image Processor is a Platform Resource that builds a derived image from the source image on the origin of an Application. It is off in a new Application, and each Application turns it on separately. With Image Processor on, a request for an image can carry an ims query string that describes a transformation. This page carries the field, the flag, and the interface that sets each one, plus the behaviors, cache fields, headers, and datasets that Image Processor reaches.
Activation
Five interfaces set the same switch, and the switch belongs to the Application: one Application can have Image Processor on while another does not.
| Interface | Where you set it | Field or flag |
|---|---|---|
| Azion Console | The Default Modules group of the Modules section, on the Main Settings tab of an Application | The Image Processor toggle, with the helper text “Enable dynamic image editing options.” |
| Azion API v4 | PATCH /v4/workspace/applications/<id> |
modules.image_processor.enabled |
| Azion API v3 | PATCH https://api.azionapi.net/edge_applications/<id> |
image_optimization |
| Azion CLI | azion create application and azion update application |
--image-processor |
azion.config.js and Azion Lib |
An entry of applications, one per Application |
imageProcessorEnabled |
modules.image_processor.enabled and imageProcessorEnabled are booleans, and both default to false. The Azion CLI flag takes a string: --image-processor true. In Azion Console, the toggle is saved with Save.
API v4 carries the switch in the modules object of the Application:
The same modules object carries application_accelerator, cache, and functions, each with its own enabled boolean. API v3 names the switch image_optimization and takes it at the top level of the body.
Rules Engine behaviors
A rule that processes an image uses three Rules Engine behaviors. Optimize Images requires Image Processor on the Application that runs the rule.
| Behavior | Phase | API type | What it does |
|---|---|---|---|
| Optimize Images | Request Phase | optimize_images |
Applies Image Processor to the matched request. It takes no attributes. |
| Set Cache Policy | Request Phase | set_cache_policy |
Applies a cache setting to the matched request. |
| Add Request Header | Request Phase | add_request_header |
Adds a header to the request. |
For Set Cache Policy, attributes.value carries the id of the cache setting, and in Azion Console you select it in a second dropdown. For Add Request Header, attributes.value takes the form Field: value, such as Accept: image/webp or Accept: image/avif, which is what a conversion to those formats requires.
A criterion of the same rule carries variable, operator, conditional, and argument. A rule that matches image requests reads ${request_uri} or ${uri} with the matches operator, against an argument such as \.(jpg|jpeg|gif|bmp|png|ico|webp|avif). ${request_uri} requires Application Accelerator on the Application: while Application Accelerator is off, the API refuses a rule that reads it and returns the error 25047. ${uri} depends on no Platform Resource.
Cache variation
A derived image is cached under a key of its own when its cache setting varies the cache on ims, because the cache key then includes the ims query string. A variation with a converted format also carries the file format after the @@ separator, as in httpsstatic.example.com/static/images/image_1.jpg?ims=880x@@webp.
Varying the cache on a query string uses an Application Accelerator field: cache_vary_by_querystring, under modules.application_accelerator in a cache setting. So varying the cache on ims requires Application Accelerator, while processing an image does not.
In Azion Console, each field maps to a control of the Cache vary by Query String panel, in the Application Accelerator section of a cache setting:
| Field | Console control | What it sets |
|---|---|---|
cache_vary_by_querystring.behavior |
Behavior | How the cache handles query string parameters. The dropdown offers Allowlist, Denylist, Ignore, and All. |
cache_vary_by_querystring.fields |
Fields | The query string parameters considered for cache variation, one per line. |
cache_vary_by_querystring.sort_enabled |
Sort | Whether query string parameters are sorted, so that cache behavior does not depend on the order they arrive in. |
A cache setting for images carries ims in fields. For the rest of the fields a cache setting carries, including the maximum age of the cached object, refer to Cache settings. For the other fields Application Accelerator unlocks, refer to Application Accelerator settings.
Response headers
Azion returns two headers on a response that Image Processor processed.
| Header | What it carries |
|---|---|
x-ims |
Whether Image Processor handled the response. A processed response carries x-ims: Enabled. |
x-original-image-size |
The size in bytes of the source image, before the transformation. |
Usage and event data
Azion reports Image Processor activity on six surfaces: four in Azion Console, two each in Real-Time Metrics and Real-Time Events, and two in GraphQL.
| Surface | What it carries |
|---|---|
| The Image Processor tab of Real-Time Metrics | Metrics for the requests made to the images processed through Image Processor in your account, as Total Requests and Total Requests per Second charts. |
| The Bandwidth Saving dashboard in the Applications tab of Real-Time Metrics | The bytes Image Processor saved on the images it processed and delivered. |
| The Image Processor dataset of Real-Time Events | The event records of requests made to Applications that use Image Processor. |
| The Proxy Upstream field of Real-Time Events | ims_http, the value the field reads when Image Processor answered as the upstream. |
| The consumption dataset of GraphQL | productId 1441110021 and the metric images_processed, the total number of images processed by Image Processor. |
| The metrics datasets of GraphQL | The imagesProcessedMetrics dataset and its fields. |
In Azion Console, the Image Processor dataset of Real-Time Events requires Image Processor on, and in GraphQL it is the imagesProcessedEvents dataset. The consumption data is available for up to 24 months, and a Real-Time Events record is kept for 7 days. To build the consumption query and read its response, refer to Query usage data from Image Processor.
WASM Image Processor library
WASM Image Processor is a WebAssembly library that processes images inside a Function. It provides loadImage, resize, getImageResponse, and clean, and it writes webp, jpeg, and png. It runs in the code of that Function, separately from the Image Processor Platform Resource and the fields on this page. For more information, refer to WASM Image Processor.