Merge branch 'main' into chesterkxng

This commit is contained in:
Ibrahima G. Coulibaly
2024-06-27 18:47:24 +01:00
committed by GitHub
53 changed files with 1838 additions and 868 deletions

18
src/utils/gif.ts Normal file
View File

@@ -0,0 +1,18 @@
import { GifBinary } from 'omggif';
export function gifBinaryToFile(
gifBinary: GifBinary,
fileName: string,
mimeType: string = 'image/gif'
): File {
// Convert GifBinary to Uint8Array
const uint8Array = new Uint8Array(gifBinary.length);
for (let i = 0; i < gifBinary.length; i++) {
uint8Array[i] = gifBinary[i];
}
const blob = new Blob([uint8Array], { type: mimeType });
// Create File from Blob
return new File([blob], fileName, { type: mimeType });
}