Create image with the
<canvas>
element
yarn add create-image-in-browser
import createImage from 'create-image-in-browser'
const buffer = await createImage('path/to/paint-script.js')
console.log(result)
//=> <Buffer 89 50 4e 47 0d ...>
- type:
string|URL
Path to the paint script
- type:
Serializable
Data for the paint script
{
type?: "image/png" | "image/jpeg" | "image/webp",
quality: number,
}
Options for Canvas#toBlob()