Generate Image
Generate images in browser and node.
Installation and Usage
npm install --save generate-image
In Browser
;
or
1. Automatic:
2. Programmatic:
const target = document; const imageData = ;targetsrc = imageData;
In Node
const GenerateImage = ; const imageData = ;
API
GenerateImage.auto(attr)
argument | required | default | info |
---|---|---|---|
attr | - | 'data-gi' | data attr that provide option string for <img> |
GenerateImage(options, encode)
argument | required | default | info |
---|---|---|---|
options | - | - | options |
encode | - | true | return dataURI or pure xml |
options
argument | required | default | info |
---|---|---|---|
w | - | 300 | width |
h | - | 150 | height |
bc | - | '#F2F2F6' | background color |
fc | - | '#666' | foreground color |
t | - | '' | texture: 'diagonal' |
c | - | '' | text content |
SVG template
<!-- background color --> <!-- texture: diagonal --> <!-- text content --> { c }