refactor(utils): update imgToWebp defaults to D=96 and q=75

This commit is contained in:
2026-09-07 20:17:35 -07:00
parent 4b6ef90d3a
commit 2e840b4b86

View File

@@ -16,7 +16,7 @@ export const fmtSize = b => {
return (x >= 10 ? Math.round(x) : Math.round(x * 10) / 10) + ' ' + u[i]; return (x >= 10 ? Math.round(x) : Math.round(x * 10) / 10) + ' ' + u[i];
}; };
export const asDataURL = f => new Promise(r => { const fr = new FileReader(); fr.onload = () => r(String(fr.result || '')); fr.readAsDataURL(f); }); export const asDataURL = f => new Promise(r => { const fr = new FileReader(); fr.onload = () => r(String(fr.result || '')); fr.readAsDataURL(f); });
export const imgToWebp = (f, D = 128, q = 80) => new Promise((r, j) => { export const imgToWebp = (f, D = 96, q = 75) => new Promise((r, j) => {
if (!f) return j(); if (!f) return j();
const i = new Image; const i = new Image;
i.onload = () => { i.onload = () => {