This commit is contained in:
Dragon Fire
2024-05-09 15:21:55 -04:00
parent f969002118
commit 949db62bc6
+1 -1
View File
@@ -74,7 +74,7 @@ module.exports = class Tensorflow {
async stylizeImage(image, styleImg) {
const imageTensor = await tf.node.decodeImage(image, 3);
const [originalHeight, originalWidth] = imageTensor.shape.slice(0, 2);
const desiredHeight = 400;
const desiredHeight = 300;
const aspectRatio = originalWidth / originalHeight;
const newWidth = Math.round(desiredHeight / aspectRatio);
const resizedImage = tf.image.resizeBilinear(imageTensor, [newWidth, desiredHeight]);