I am using openresty Nginx to server images, how can I add avif support for the same. currently, image resizing is done via a Lua script. I found a JS solution here
import * as sharp from 'sharp';
sharp('input.png')
.toFormat('heif', { quality: 30, compression: 'av1' })
.toFile('output.avif')
.then(info => console.log(info));
Can't find any lua script for the same.
Revision:
my current lua script only resize the image to the requested size
local magick = require("magick")
magick.thumb(source_fname, size, dest_fname)
I want a lua script to convert any requested image to avif. JS solution works but can't integrate that in the openresty nginx server