mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
33 lines
846 B
TypeScript
33 lines
846 B
TypeScript
|
|
import { emojiRenderer } from "./services/emojiRenderer";
|
|
import { createCanvas } from "canvas";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
|
|
async function run() {
|
|
const width = 500;
|
|
const height = 200;
|
|
const canvas = createCanvas(width, height);
|
|
const ctx = canvas.getContext("2d");
|
|
|
|
ctx.fillStyle = "white";
|
|
ctx.fillRect(0, 0, width, height);
|
|
|
|
ctx.fillStyle = "black";
|
|
ctx.font = "30px Arial";
|
|
|
|
const text = "Hello 🌍 World! 😂";
|
|
console.log(`Rendering text: ${text}`);
|
|
|
|
try {
|
|
await emojiRenderer.drawText(text, ctx, 50, 100, 30);
|
|
const buffer = canvas.toBuffer("image/png");
|
|
fs.writeFileSync("emoji_test.png", buffer);
|
|
console.log("Image saved to emoji_test.png");
|
|
} catch (error) {
|
|
console.error("Error rendering emoji:", error);
|
|
}
|
|
}
|
|
|
|
run();
|