import { copy, readFile, remove, rename } from 'fs-extra'
import { copy, readFile, remove, rename } from 'fs-extra'
import { getLowercaseExtension } from './core-utils'
import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
import { logger } from './logger'
import { getLowercaseExtension } from './core-utils'
import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
import { logger } from './logger'
} catch (err) {
logger.debug('Cannot read %s with jimp. Try to convert the image using ffmpeg first.', path, { err })
} 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)
await convertWebPToJPG(path, newName)
await rename(newName, path)