I have a image need to upscale, I use sharp(node.js) to execute this action. the pixel count of the original image edge in a line of the vertical direction is about 3, after upscaling by 4 times, the result pixel count is more than 10. how can I keep the pixel thickness of the edge after scaling operation. I tried many methods and failed, the only ideal result is from the webpage service (AI Image Enlarger). can I reach this on my local machine? any help would be great appreciated.
Below is my code
sharp_resize(`/Users/cc/Desktop/alpha.png`, `/Users/cc/Desktop/alpha_x4.png`)
function sharp_resize(srcPath, targetPath) {
const dimensions = sizeOf(srcPath)
let width = dimensions.width
let height = dimensions.height
sharp(srcPath)
.resize(width*4,height*4,{
kernel: sharp.kernel.lanczos3,
})
.toFile(targetPath, (err, info) => {
console.log(`sharp resize ${targetPath}`);
});
}