Copyright (C) 2023 Toranoana Lab Inc. All Rights Reserved.
2024
Deno でOGP画像を作るには
tsx + css - (satori) -> SVG - (svg2png-wasm) -> PNG で処理
import satori from "npm:satori";
import * as svg2png from "npm:svg2png-wasm";
await svg2png.initialize(
await fetch("https://unpkg.com/svg2png-wasm/svg2png_wasm_bg.wasm"),
);
export async function createOgp(id: string) {
const svg = await satori(
***
,
{
width: 600,
height: 315,
},
);
const convert_options: svg2png.ConverterOptions = {
defaultFontFamily: {
sansSerifFamily: "Noto Sans JP",
},
};
const png = await svg2png.svg2png(svg, convert_options);
}