This commit is contained in:
Dragon Fire
2024-05-09 15:27:54 -04:00
parent 949db62bc6
commit 30af40d20b
2 changed files with 2 additions and 2 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 39 KiB

+2 -2
View File
@@ -74,10 +74,10 @@ 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 = 300;
const desiredHeight = 400;
const aspectRatio = originalWidth / originalHeight;
const newWidth = Math.round(desiredHeight / aspectRatio);
const resizedImage = tf.image.resizeBilinear(imageTensor, [newWidth, desiredHeight]);
const resizedImage = tf.image.resizeBilinear(imageTensor, [desiredHeight, newWidth]);
imageTensor.dispose();
const loadedImage = resizedImage.toFloat().div(tf.scalar(255)).expandDims();
resizedImage.dispose();