feat: integrate Sensei Spook mascot in 4 stances, speech bubbles, and style updates
This commit is contained in:
commit
e04672db2a
104 files changed
+8262
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { spawn } from "child_process";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
/**
|
||||
* Executes the Python watermark processor on an image file on disk.
|
||||
* Applies:
|
||||
* 1. School logo without background in top-left corner
|
||||
* 2. Scannable official WeChat QR code in bottom-right corner
|
||||
* 3. Bottom text: '上海健志空手道馆 · Shanghai Karate Club · Est. 2008'
|
||||
*/
|
||||
export async function applyWatermarkToFile(filePath: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return resolve();
|
||||
}
|
||||
|
||||
const scriptPath = path.join(process.cwd(), "watermark_processor.py");
|
||||
const py = spawn("python", [scriptPath, filePath, filePath]);
|
||||
|
||||
py.on("close", (code) => {
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
} else {
|
||||
console.warn(`[Watermark] Python watermark process exited with code ${code}`);
|
||||
resolve(); // Graceful fallback
|
||||
}
|
||||
});
|
||||
|
||||
py.on("error", (err) => {
|
||||
console.warn("[Watermark] Failed to spawn watermark process:", err);
|
||||
resolve(); // Graceful fallback
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user