Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Merge

Manav Rathi8bc80d282120
diff --git a/web/apps/photos/src/services/face/f-index.ts b/web/apps/photos/src/services/face/f-index.ts
index 7358e77531..53f2c41db9 100644
--- a/web/apps/photos/src/services/face/f-index.ts
+++ b/web/apps/photos/src/services/face/f-index.ts
@@ -737,20 +737,17 @@ const extractFaceCrop = (
const paddedBox = roundBox(enlargeBox(alignmentBox, 1.5));
- return cropImage(imageBitmap, paddedBox, 256);
-};
+ const outputSize = { width: paddedBox.width, height: paddedBox.height };
-const cropImage = (
- imageBitmap: ImageBitmap,
- box: Box,
- maxDimension: number,
-) => {
- const outputSize = { width: box.width, height: box.height };
+ const maxDimension = 256;
+ const scale = Math.min(
+ maxDimension / paddedBox.width,
+ maxDimension / paddedBox.height,
+ );
- const scale = Math.min(maxDimension / box.width, maxDimension / box.height);
if (scale < 1) {
- outputSize.width = Math.round(scale * box.width);
- outputSize.height = Math.round(scale * box.height);
+ outputSize.width = Math.round(scale * paddedBox.width);
+ outputSize.height = Math.round(scale * paddedBox.height);
}
const offscreen = new OffscreenCanvas(outputSize.width, outputSize.height);
@@ -766,7 +763,7 @@ const cropImage = (
height: outputSize.height,
});
- const enlargedBox = enlargeBox(box, 1.5);
+ const enlargedBox = enlargeBox(paddedBox, 1.5);
const enlargedOutputBox = enlargeBox(outputBox, 1.5);
offscreenCtx.drawImage(