0.0.1 • Published 2 years ago

create-image-in-browser v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

create-image-in-browser

Build Status Coverage Npm Version MIT License

Create image with the <canvas> element

Installation

yarn add create-image-in-browser

Usage

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 ...>

API

createImage(script, data?, options?)

script

  • type: string|URL

Path to the paint script

data

Data for the paint script

options

{
  type?: "image/png" | "image/jpeg" | "image/webp",
  quality: number,
}

Options for Canvas#toBlob()