blobToJpegArrayBuffer
Converts a Blob object to a JPEG ArrayBuffer with the specified quality.
The conversion is a canvas re-encode, which keeps only the pixels — EXIF, GPS, XMP and the ICC profile are dropped by construction. Pass BlobToJpegArrayBufferOptions.shouldPreserveMetadata to carry those segments across from the source, which works only when the source is itself a JPEG: nothing else stores them in a form that can be copied verbatim.
Import:
import { blobToJpegArrayBuffer } from 'obsidian-dev-utils/blob';Signature:
function blobToJpegArrayBuffer(blob: Blob, jpegQuality: number, options: BlobToJpegArrayBufferOptions | undefined): Promise<ArrayBuffer>Parameters:
| Parameter | Type | Description |
|---|---|---|
blob | Blob | The Blob object to convert. |
jpegQuality | number | The quality of the JPEG image (0 to 1). |
options | BlobToJpegArrayBufferOptions | undefined | Conversion options. |
Returns: Promise<ArrayBuffer> — A Promise that resolves to an ArrayBuffer.
Links to this page: