Hello guys i have following problem. On my website a user have the ability to upload images. That images are gonna get resized because of size and space on disk etc.
I am using sharp
to resize the image: https://www.npmjs.com/package/sharp
In my test, i uploaded a image ~3000x2000, it is getting resized to 600x600. I also resize it to 300x300 and 120x120. At 120x120 the image looks just blurr..
Here is the image, not resized. This image is 3000x2000 but is resized to ~600x600 with the browser:
And here is the image resized with Sharp to 600x600:
As you can see the image below has a lower quality. Why is that?
Here is the part that is resizing my image:
let resizeData = await sharp(dir + path)
.resize({ width: 600, height: 600 })
.toBuffer();
fs.writeFileSync(dir + path, resizeData);
Did i miss some configs? Is it possible to keep the quality?