diff --git a/src/ts/image.ts b/src/ts/image.ts index 0a0d3fa3..20eb3b47 100644 --- a/src/ts/image.ts +++ b/src/ts/image.ts @@ -3,8 +3,7 @@ import { selectSingleFile } from "./util"; import { v4 } from "uuid"; import { DataBase } from "./storage/database"; import { get } from "svelte/store"; -import { checkImageType, isAPNG } from "./parser"; -import { PngChunk } from "./pngChunk"; +import { checkImageType } from "./parser"; const inlayStorage = localforage.createInstance({ name: 'inlay', diff --git a/src/ts/parser.ts b/src/ts/parser.ts index f0a1f1b3..3348e051 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -253,9 +253,6 @@ export async function convertImage(data:Uint8Array) { } const type = checkImageType(data) if(type !== 'Unknown' && type !== 'WEBP' && type !== 'AVIF'){ - if(type === 'PNG' && isAPNG(data)){ - return data - } return await resizeAndConvert(data) } return data @@ -328,22 +325,6 @@ export function checkImageType(arr:Uint8Array):ImageType { return "Unknown"; } -export function isAPNG(pngData: Uint8Array): boolean { - const pngSignature = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]; - const acTL = [0x61, 0x63, 0x54, 0x4C]; - - if (!pngData.slice(0, pngSignature.length).every((v, i) => v === pngSignature[i])) { - throw new Error('Invalid PNG data'); - } - - for (let i = pngSignature.length; i < pngData.length - 12; i += 4) { - if (pngData.slice(i + 4, i + 8).every((v, j) => v === acTL[j])) { - return true; - } - } - return false; -} - function wppParser(data:string){ const lines = data.split('\n'); let characterDetails:{[key:string]:string[]} = {};