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)
})
})
Also in JavaScript:
- The value associated with each key will be an array consisting of all the elements that resulted in that return value when passed into the callback.
- jquery droppable allow what can be dropped
- string contains javascript
- custom event js
- i18n angular
- react fragment
- angular directive example
- open bootstrap modal using javascript
- p5js right mouse button released
- expo build apk
- js create element with class
- javascript remove last element from array
- return value from fetch javascript
- replace innerhtml javascript by regex
- js array delete last
- nextjs svg npm
- get data from fetch api into variable
- jqery get text
- how to convert entered number into currency in words in javascript
- email regex javascript
- deep copy javascript
- clone node javascript
- verify input is not Nan js
- javascript play many background music