make image fit
This commit is contained in:
parent
49c6282784
commit
1ebd111e85
1 changed files with 2 additions and 0 deletions
|
@ -47,6 +47,7 @@ export function MakePrediction(election : Election, overlay_image?: string, over
|
|||
const url = await fetch(overlay_image);
|
||||
const arrayBuffer = await url.arrayBuffer();
|
||||
const overlayBuffer = Buffer.from(arrayBuffer);
|
||||
const { width, height } = await sharp(png).metadata();
|
||||
|
||||
const overlay = await sharp(overlayBuffer)
|
||||
.composite([{
|
||||
|
@ -59,6 +60,7 @@ export function MakePrediction(election : Election, overlay_image?: string, over
|
|||
tile: true,
|
||||
blend: 'dest-in',
|
||||
}])
|
||||
.resize(width, height)
|
||||
.png()
|
||||
.toBuffer();
|
||||
|
||||
|
|
Loading…
Reference in a new issue