From ef01c37cdf4e83d7cd7b496e5a386aae98bc0d07 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Sat, 25 Feb 2023 16:11:53 +0800 Subject: [PATCH] fix: integer problem --- utils/dalle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/dalle.js b/utils/dalle.js index e9ebd8d..f0e7d42 100644 --- a/utils/dalle.js +++ b/utils/dalle.js @@ -67,8 +67,8 @@ async function resizeAndCropImage (inputFilePath, outputFilePath, size = 512) { const maxDimension = Math.max(metadata.width, metadata.height) logger.mark(`original picture size is ${metadata.width} x ${metadata.height}`) // Calculate the required dimensions for the output image - const outputWidth = size * metadata.width / maxDimension - const outputHeight = size * metadata.height / maxDimension + const outputWidth = Math.round(size * metadata.width / maxDimension) + const outputHeight = Math.round(size * metadata.height / maxDimension) // Resize the image to the required dimensions await sharp(inputFilePath)