Inline
This commit is contained in:
parent
7d122f825c
commit
6ce956c5bb
2 changed files with 6 additions and 7 deletions
|
@ -220,8 +220,7 @@ class FaceService {
|
|||
face.detection,
|
||||
);
|
||||
|
||||
const blobOptions = DEFAULT_ML_SYNC_CONFIG.faceCrop.blobOptions;
|
||||
const blob = await imageBitmapToBlob(faceCrop.image, blobOptions);
|
||||
const blob = await imageBitmapToBlob(faceCrop.image);
|
||||
|
||||
const cache = await openCache("face-crops");
|
||||
await cache.put(face.id, blob);
|
||||
|
|
|
@ -450,17 +450,17 @@ export interface BlobOptions {
|
|||
quality?: number;
|
||||
}
|
||||
|
||||
export async function imageBitmapToBlob(
|
||||
imageBitmap: ImageBitmap,
|
||||
options?: BlobOptions,
|
||||
) {
|
||||
export async function imageBitmapToBlob(imageBitmap: ImageBitmap) {
|
||||
const offscreen = new OffscreenCanvas(
|
||||
imageBitmap.width,
|
||||
imageBitmap.height,
|
||||
);
|
||||
offscreen.getContext("2d").drawImage(imageBitmap, 0, 0);
|
||||
|
||||
return offscreen.convertToBlob(options);
|
||||
return offscreen.convertToBlob({
|
||||
type: "image/jpeg",
|
||||
quality: 0.8,
|
||||
});
|
||||
}
|
||||
|
||||
export async function imageBitmapFromBlob(blob: Blob) {
|
||||
|
|
Loading…
Add table
Reference in a new issue