Created
August 30, 2018 05:14
-
-
Save bootrino/7edfc6b2e5ee6142a786069d0ba2f72e to your computer and use it in GitHub Desktop.
nodejs transform image with sharp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function transformImage(dataBytes: any) { | |
//let convert = async(dataBytes: any) => sharp(dataBytes).background({r: 255, g: 255, b: 255, alpha: 0}).toFormat('png').toBuffer() | |
let convert = async(dataBytes: any) => sharp(dataBytes).toFormat('png').toBuffer() | |
dataBytes = await(convert(dataBytes)) | |
return dataBytes | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment