INNER CODE UNIT · TypeScript
renderOne
PaulWoitaschek/Voice · artwork/src/render/render.ts:58
async function renderOne(
browser: Browser,
baseUrl: string,
asset: AssetSpec,
locale: string,
index: number,
): Promise<string> {
const url = `${baseUrl}${asset.template}?locale=${encodeURIComponent(locale)}&index=${index}`
// Render at 3× then downsample with Lanczos3. The browser rasterises text and
// image scaling with more pixel data, so the final 1× PNG (esp. the small
// phone-mockup inside the feature graphic) reads as crisp rather than fuzzy.
// 3× over 2× makes a visible difference on the 1024×500 feature graphic
// because Play Store displays it at 2-3× DPR on retina screens.
const SUPERSAMPLE = 3
const page: Page = await browser.newPage({
viewport: { width: asset.width, height: asset.height },
deviceScaleFactor: SUPERSAMPLE,
})