Image optimizations
Overview
When using image URLs from the API, search parameters can be added to the URL to taylor the returned image for your product and optimize performance. All these parameters are optional.
Supported search parameters
Height
Set the height in pixels of the returned image. Cropping is to ensure the image fills the specified size without distortion.
- Parameter: h
- Default: 1
- Value: Integer between 1 and 2500 inclusive (A value of 1 denotes the original height of image)
Width
Set the width in pixels of the returned image. Cropping is used to ensure the image fills the specified size without distortion.
- Parameter: w
- Default: 1
- Value: Integer between 1 and 2500 inclusive (A value of 1 denotes the original height of image)
Quality
Set the quality in percentage and compression the returned image accordingly.
- Parameter: q
- Default: 75
- Value: Multiple of 5 between 0 and 100 inclusive
Examples
The following URL uses h, w and q to receive a 100 x 100 pixel image at 50% quality for increase compression. This reduces the image from 2.4MB to 2.3KB (1000 times smaller!)
Recommendations
When using Sanctuary Health images in your product it is advised to adjust the height and width parameters to the pixel size of the element on the users screen. This minimizes the file size without affecting quality decreasing network load and increasing product performance. Finally adjust the quality parameter to achieve the quality vs compression trade off your team is happy with.