Created
February 24, 2019 18:49
-
-
Save uditalias/8f3bb2e1a35ee0cc34c18adc9b937c1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected async _render(): Promise<sharp.Sharp> { | |
const languages = this.hydrateRendererLanguages() | |
, totalLanguages = languages.length | |
, [width, height] = this.calculateCanvasSize(totalLanguages) | |
, destWidth = width * this.options.scale | |
, destHeight = height * this.options.scale | |
, dpi = DEFAULT_DPI * destWidth / width | |
, svg = Buffer.from(handlebars.compile(SOLID_TEMPLATE)({ languages, width, height })); | |
return sharp(svg, { density: dpi }) | |
.resize(destWidth, destHeight); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment