CDN Rendering API

This article explains how to use the creoline® CDN Rendering API. The parameters listed here are configured at runtime using HTTP query parameters.



Prerequisites

To use the Rendering API, you must first activate it through our Customer Center. To do this, log in to our Customer Center at account.creoline.com and select the CDN resource for which you want to enable the Rendering API. Then open the settings via the Settings tab and enable the Rendering API there.


Image manipulation can only be used for source resources up to 10 MiB and image sizes up to 5,000 x 5,000 pixels. If the source file on your target server is larger than 10 MB or exceeds the dimensions of 5,000 x 5,000 pixels, the original file will be returned.




Parameter Overview

Parameter Default Value Description
w NULL Image width
h NULL Image height
ar 1 Preserve aspect ratio
q NULL Image quality (JPG, PNG, WebP)
webp 1 Automatically generate WebP image
avif 1 Automatically generate AVIF images
c default Possible values: default (default), gray (grayscale)



Disable Automatic WebP Conversion

You can use the webp parameter to disable the automatic conversion of WebP images.


# Original image
https://assets.cstatic.io/img/cdn/example-resize.jpg

# JPG image is not automatically converted to WebP:
https://assets.cstatic.io/img/cdn/example-resize.jpg?webp=0



Resizing Images

Image resizing can be defined using the w (width) and h (height) parameters. Adjusting image dimensions is useful, for example, for generating thumbnails on preview pages without having to generate additional thumbnails.


# Original image
https://assets.cstatic.io/img/cdn/example-resize.jpg

# Image size reduced to: 250x250
https://assets.cstatic.io/img/cdn/example-resize.jpg?w=250




In this example, the image is rendered at a size of 250px * 250px, with the default resizing taking the aspect ratio into account.


The ar (aspect ratio) parameter allows images to be generated independently of their actual aspect ratio.


Warning: Disabling aspect ratio consideration may result in unintended manipulation of graphics.


Example:

# Original image
https://assets.cstatic.io/img/cdn/example-resize.jpg

# Image size reduced to: 250x350
https://assets.cstatic.io/img/cdn/example-resize.jpg?w=250&h=350&ar=0



Adjusting Image Quality

The HTTP query parameter q can be used to adjust the image quality independently of the CDN settings. Different parameters are available depending on the image type.


Image quality for JPG, AVIF, and WebP images:

Parameter Value Quality
q 20 Low
q 40 Medium
q 60 Good
q 80 Very good (recommended)
q 100 Original


Image compression for PNG images:

Parameter Value Quality
q 6 Medium
q 7 Good
q 8 Very good
q 9 Maximum (recommended)


In the settings for your CDN resource, you can define global settings for each image type, so that specifying the quality in the URL is not necessary. To do this, go to the Customer Center under CDNSettings to define the quality for each image type.