Hearthstone Deck Imager
Convert Hearthstone deckstrings into images similar to what would be displayed in Hearthstone.
Installation
Simply run
npm install --save hs-deck-imager
The installation includes all necessary fonts, card tiles, and the latest version of cards.collectible.json.
Usage
After importing the module, using imageFromDeckstring will generate an image file given a deckstring and destination file path.
For example,
const DeckImager = require('hs-deck-imager');
const imgPath = 'example.jpg';
let resultPath = DeckImager.imageFromDeckstring(
'AAECAaIHBLICrwTtBYHCAg20AYwCzQO9BJsFiAekB90Ihgn1uwLrwgLc0QLb4wIA',
imgPath
);
if(imgPath !== resultPath){
// an error occurred; handle as you like
}
This will created an image at the given path. For the above command, the following output was generated:
Acknowledgements
Thanks to HearthSim for the card tiles and json data.