feat: change gif speed

This commit is contained in:
Ibrahima G. Coulibaly
2024-06-27 12:39:38 +01:00
parent 13f5d258dc
commit f4e1c06270
18 changed files with 420 additions and 104 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 });
}