1.0.4 • Published 5 years ago

generator-cover v1.0.4

Weekly downloads
88
License
MIT
Repository
github
Last release
5 years ago

Used to quickly generate Chinese book covers

Installation

! Please install before use node-canvas

  $ npm install generator-cover --save
   or
  $ yarn add generator-cover
   or
  $ cnpm install generator-cover --save

Docs

attributetypedefaultrequiredexplain
bookNameStringyestitle
fontColorColor"#FFFFFF"nofont color(Gradient color is not supported at this time)
fontStyleString'74px "Source Han Serif"'noThe property uses the same syntax as the CSS font property。
bgColorColor"#000000"nobackground color(Gradient color is not supported at this time)
bgImagelocal file/remote URL/base64noBackground image
savePathPath__dirnamenoFile save path
fileNameStringDate.now().jpgnoFile save name
qualityNumber1noOutput quality(0 - 1)
fontObjectnoCustom font font file name cannot be Chinese
widthNumber470(px)noCover the width
heightNumber750(px)noCover the height
leftNumber90(px)noLeft margin of title

Examples

'use strict';

const generatorCover = require('generator-cover');

generatorCover({
  bookName: '醒世姻缘传',
  fontStyle: '74px "Source Han Serif"',
  bgColor: '#BCE3E7',
  fontColor: '#4A70A9',
  fileName: '醒世姻缘传.png',
  savePath: __dirname,
  quality: 1,
  width: 470,
  height: 750,
  left: 90
  // font: {
  //   fontPath: 'fontPath',
  //   family: 'fontFamily'
  // },
}).then(res => {
  console.log('cover path:', res);
});

License

MIT

Copyright (c) 2019-present, ibyli

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago