Customize output options
Use the OUTPUT_OPTIONS
parameter to customize generated images.
You may need to customize more than just the size of the images generated by this extension (for example, changing the image quality). That is why you can specify the output options parameter.
The OUTPUT_OPTIONS
parameter allows you to customize the output options separately for each image format you wish to use. For example, if you want to reduce the quality of the png images uploaded to your bucket, you can enter an options map like this:
{ "png": { "quality": 50 } }
The
quality
option accepts a number 0-100 and defaults to 80. See a full list of png image output options.
The OUTPUT_OPTIONS
parameter
The output options parameter must be a valid JSON object that maps the preferred image formats to their option objects. For example:
{
"jpeg": { "quality": 5, "chromaSubsampling": "4:4:4" },
"png": { "pallete": true }
}
The extension will use
JSON.parse()
method to parse the output options object.
Image formats and Format options not included in the above object will fall back to the default.
Output options API
The extension uses the Sharp open-source library to process images uploaded to your bucket. See the official Sharp documentation for a complete list of options for each image format. The list also includes the default value for each output option.