mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-22 01:18:19 +01:00
Option to send photos as high quality
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user