perf: 体积从 105.1 MB 降到 28.9 MB(音频转 Opus、图片无损 WebP)
- 两首 flac 母带移入 masters/(gitignore,不入库),转 Opus 128k VBR:3.35 + 3.16 MB - xilian 三张真 PNG RGBA → 无损 WebP(3.39→1.80、5.01→2.83、3.38→1.76 MB) - kv37_xilian.png → 无损 WebP 5.13→2.75 MB - kv37 五张图本来就是 WebP(扩展名误写成 .png),本次只改名并把 atlas 页名改为 .webp - 删除死文件 dist/jsconfig.json - 新增 tools/rawdiff.mjs(区分可见差异与仅透明下差异)、tools/atlas-pages.mjs 验证:check-paths 11/11;0 个非 favicon 的 404;无损 WebP 可见像素 0 差异; libwebp 会改写完全透明像素下的 RGB(xilian 三图 32-49% 像素),渲染级对拍 与 PNG 版相差 0.052/255、热力图全空,确认未因 Linear 过滤渗色。
This commit is contained in:
1 parent
8ad177c822
commit
a391021041
27 files changed
+3006
-2879
No files matched your search
@@ -0,0 +1,31 @@
|
||||
// 改写 .atlas 里的贴图页名后缀(页名行是形如 `xilian.png` 的独立一行)。
|
||||
// 逐行处理、只改匹配 `^\S+\.png$` 的行,保留原有行尾与其余内容,避免误伤区域名。
|
||||
// 用法:node tools/atlas-pages.mjs <a.atlas> [后缀替换: .png=.webp] [--dry]
|
||||
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const file = args[0];
|
||||
if (!file) {
|
||||
console.error("usage: node tools/atlas-pages.mjs <a.atlas> [.png=.webp] [--dry]");
|
||||
process.exit(2);
|
||||
}
|
||||
const pair = (args.find((a) => a.includes("=")) ?? ".png=.webp").split("=");
|
||||
const dry = args.includes("--dry");
|
||||
|
||||
const text = await readFile(file, "utf8");
|
||||
const lines = text.split("\n");
|
||||
let changed = 0;
|
||||
const out = lines.map((line) => {
|
||||
const m = line.match(/^(\S+\.png)(\r?)$/); // 注意保留 CRLF 行尾,实测这两个 .atlas 是 CRLF
|
||||
if (!m) return line;
|
||||
changed++;
|
||||
return line.replace(/\.png(\r?)$/, `${pair[1]}$1`);
|
||||
});
|
||||
|
||||
if (!changed) {
|
||||
console.log(`${file}: 没有需要改写的页名行`);
|
||||
process.exit(0);
|
||||
}
|
||||
console.log(`${file}: ${changed} 个页名 → ${pair[1]}${dry ? "(试运行,未写入)" : ""}`);
|
||||
if (!dry) await writeFile(file, out.join("\n"), "utf8");
|
||||
Reference in new issue
Block a user