feat: genasset 离线素材管线(oMLX SVG 生成 + svg2png 打包 + 对比点评回填)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 16:04:54 +08:00
co-authored by Claude Opus 4.7
parent 950ca9194b
commit 0a8fd6c8a2
7 changed files with 1262 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
// 用法: node svg2png.mjs <srcDir> <outDir> [width]
// 把 srcDir 下所有 .svg 转为 outDir 下同名 .png(默认 800 宽,2x 高清)
import sharp from 'sharp'
import { readdirSync, mkdirSync } from 'fs'
import { join } from 'path'
const [srcDir, outDir, widthArg] = process.argv.slice(2)
const width = Number(widthArg) || 800
mkdirSync(outDir, { recursive: true })
let n = 0
for (const f of readdirSync(srcDir)) {
if (!f.endsWith('.svg')) continue
const out = join(outDir, f.replace(/\.svg$/, '.png'))
await sharp(join(srcDir, f)).resize({ width }).png().toFile(out)
n++
console.log('png:', out)
}
console.log(`done: ${n} files`)