Members
canvasSize :CardCreator~CanvasDimensions
The canvas's dimensions.
Type:
- Source:
Methods
(async) createCard(charaId, customImage) → {Promise.<Buffer>}
Creates a character card for a character.
Parameters:
Name | Type | Description |
---|---|---|
charaId |
number | string | The Lodestone ID of the character to generate a card for. |
customImage |
string | Buffer | null | undefined | Optional parameter providing a custom image to be drawn between the background of the character card and the black information boxes. The image should be the same resolution as the default image. The default image size can be retrieved with CardCreator#canvasSize. May be a URL, `data: `URI, a local file path, or a Buffer instance. |
- Source:
Returns:
A promise representating the construction of the card's image data.
- Type
- Promise.<Buffer>
Example
const fs = require("fs");
const card = new CardCreator();
const lodestoneId = "13821878";
await card.ensureInit();
const png = await card.createCard(lodestoneId);
fs.writeFile("./test.png", png, err => {
if (err) console.error(err);
});
(async) ensureInit() → {Promise}
Ensures that the instance is ready to generate character cards.
This function must be resolved before using character card
generation methods.
- Source:
Returns:
A promise representing the initialization state of this generator.
- Type
- Promise
Type Definitions
CanvasDimensions
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
width |
number | The width of the canvas. |
height |
number | The height of the canvas. |
- Source: