Answers for "nodejs sharp change image to multiple sizes"

0

nodejs sharp change image to multiple sizes

// Sharp and FS module needed.
;(async function(){
	let imgBuffer = await sharp("./myimage.jpg").toBuffer()
    let thumbnail = await sharp(imgBuffer).resize(100, 100).toBuffer()
    let image = await sharp(imgBuffer).resize(1600, 900).toBuffer()
    fs.writeFile("./thumbnail.jpg", thumbnail, err => {
    	if(err) console.log(err)
    })
    fs.writeFile("./image.jpg", thumbnail, err => {
      if(err) console.log(err)
    })
})
Posted by: Guest on October-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language