[feat] new pngchunk encode/decoderr

This commit is contained in:
kwaroran
2024-01-03 04:13:19 +09:00
parent 239d819383
commit a8e50dcd77
10 changed files with 196 additions and 24 deletions

View File

@@ -7,9 +7,9 @@ import { checkNullish, findCharacterbyId, selectMultipleFile, selectSingleFile,
import { v4 as uuidv4 } from 'uuid';
import { selectedCharID } from "./stores";
import { checkCharOrder, downloadFile, getFileSrc } from "./storage/globalApi";
import * as yuso from 'yuso'
import { reencodeImage } from "./image";
import { updateInlayScreen } from "./process/inlayScreen";
import { PngChunk } from "./pngChunk";
export function createNewCharacter() {
let db = get(DataBase)
@@ -473,7 +473,7 @@ export async function addDefaultCharacters() {
for(const img of imgs){
const imgBuffer = await (await img).arrayBuffer()
const readed = yuso.decode(Buffer.from(imgBuffer), "risuai")
const readed = PngChunk.read(Buffer.from(imgBuffer), ["risuai"])?.risuai
await sleep(10)
const va = decodeMsgpack(Buffer.from(readed,'base64')) as any
if(va.type !== 101){