+
+// ---------------------------------------------------------------------------
+
+async function jimpProcessor (path: string, destination: string, newSize: { width: number, height: number }) {
+ let jimpInstance: any
+
+ try {
+ jimpInstance = await Jimp.read(path)
+ } catch (err) {
+ logger.debug('Cannot read %s with jimp. Try to convert the image using ffmpeg first.', path, { err })
+
+ const newName = path + '.jpg'
+ await convertWebPToJPG(path, newName)
+ await rename(newName, path)
+
+ jimpInstance = await Jimp.read(path)
+ }
+
+ await remove(destination)
+
+ await jimpInstance
+ .resize(newSize.width, newSize.height)
+ .quality(80)
+ .writeAsync(destination)
+}