import { copy, readFile, remove, rename } from 'fs-extra'
-import * as Jimp from 'jimp'
+import Jimp, { read } from 'jimp'
import { getLowercaseExtension } from './core-utils'
import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
import { logger } from './logger'
const inputBuffer = await readFile(path)
try {
- jimpInstance = await Jimp.read(inputBuffer)
+ jimpInstance = await read(inputBuffer)
} catch (err) {
logger.debug('Cannot read %s with jimp. Try to convert the image using ffmpeg first.', path, { err })
await convertWebPToJPG(path, newName)
await rename(newName, path)
- jimpInstance = await Jimp.read(path)
+ jimpInstance = await read(path)
}
await remove(destination)