This commit is contained in:
Manav Rathi 2024-05-21 09:41:13 +05:30
parent 5aee42d59d
commit 825f5ff88d
No known key found for this signature in database

View file

@ -735,20 +735,16 @@ const extractFaceCrop = (
height: alignment.size, height: alignment.size,
}); });
const padding = 0.25; const paddedBox = roundBox(enlargeBox(alignmentBox, 1.5));
const scaleForPadding = 1 + padding * 2;
const paddedBox = roundBox(enlargeBox(alignmentBox, scaleForPadding));
return cropImage(imageBitmap, paddedBox, 256); return cropImage(imageBitmap, paddedBox, 256);
}; };
const cropImage = ( const cropImage = (
imageBitmap: ImageBitmap, imageBitmap: ImageBitmap,
cropBox: Box, box: Box,
maxDimension: number, maxDimension: number,
) => { ) => {
const box = roundBox(cropBox);
const outputSize = { width: box.width, height: box.height }; const outputSize = { width: box.width, height: box.height };
const scale = Math.min(maxDimension / box.width, maxDimension / box.height); const scale = Math.min(maxDimension / box.width, maxDimension / box.height);