canvas-poster

1.0.0 • Public • Published

canvas-poster

Draw text and pictures to canvas, and export picture data, text support color, size, newline (pre, nowrap, breakAll, breakWord), line height, bold, underline, etc.

Useage

install from npm

yarn add canvas-poster

or

npm i canvas-poster

example

import Poster from 'canvas-poster'

async function render(){
  let poster new Poster({width:200,height:200,scale:2});
  await poster.drawImage('./test.png',{w:"100%",x:0,y:0})
  poster.drawTexts([
    {text:'test render texts',size:20},{text:'test',size:30,fillStyle:'red'}
    ],
    10,
    10,
    {wordWrap:"breakAll",with:200}
  );
  let img = document.createElement('img');
  img.src = poster.getImageData();
}
render();

Readme

Keywords

none

Package Sidebar

Install

npm i canvas-poster

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

21.5 kB

Total Files

9

Last publish

Collaborators

  • hxfdarling