Option to send photos as high quality
This commit is contained in:
parent
6c56d5a5f1
commit
01eabf9ec6
44 changed files with 1263 additions and 363 deletions
|
@ -1,17 +1,11 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { canvasToBlob } from './canvasToBlob';
|
||||
|
||||
export async function canvasToArrayBuffer(
|
||||
canvas: HTMLCanvasElement
|
||||
): Promise<ArrayBuffer> {
|
||||
const blob: Blob = await new Promise<Blob>((resolve, reject) => {
|
||||
canvas.toBlob(result => {
|
||||
if (result) {
|
||||
resolve(result);
|
||||
} else {
|
||||
reject(new Error("Couldn't convert the canvas to a Blob"));
|
||||
}
|
||||
}, 'image/webp');
|
||||
});
|
||||
const blob = await canvasToBlob(canvas);
|
||||
return blob.arrayBuffer();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue