X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fimage-utils.ts;h=033be2c50970df39a70463720682cd3604da063b;hb=ddd677e4fdef4544773f6f426b4853d494df615e;hp=c76ed545bb2b2bdba91fe33183cd6d2567cfda4b;hpb=d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts index c76ed545b..033be2c50 100644 --- a/server/helpers/image-utils.ts +++ b/server/helpers/image-utils.ts @@ -1,5 +1,5 @@ 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' @@ -47,7 +47,7 @@ async function jimpProcessor (path: string, destination: string, newSize: { widt 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 }) @@ -55,7 +55,7 @@ async function jimpProcessor (path: string, destination: string, newSize: { widt await convertWebPToJPG(path, newName) await rename(newName, path) - jimpInstance = await Jimp.read(path) + jimpInstance = await read(path) } await remove(destination)