width and height with node js
const fs = require('fs');
const sharp = require('sharp');
const inputImagePath = 'input.jpg';
const outputImagePath = 'output.jpg';
const targetWidth = 500;
const targetHeight = 300;
sharp(inputImagePath)
.resize(targetWidth, targetHeight)
.toFile(outputImagePath, (err, info) => {
if (err) {
console.error(err);
} else {
console.log('Image resized successfully!');
console.log('Input Image:', info.input);
console.log('Output Image:', info.output);
}
});