TakumiTakumi

From Satori

Migrate from Satori to Takumi with your existing components.

Takumi aims to create a universal image generation library that can be used in any environment and not just limited to JavaScript runtime.

If you are migrating from next/og, check out the From Next.js ImageResponse guide instead.

Takumi renders your nodes/components to rasterized images directly, we don't support rendering to SVG at this moment.

Installation

npm i @takumi-rs/core @takumi-rs/helpers

Make sure to mark @takumi-rs/core as external if you are using a bundler like Vite or Webpack

Code changes


import  from "satori"; 
import {  } from "@resvg/resvg-js"; 
import {  } from "@takumi-rs/helpers/jsx"; 
import {  } from "@takumi-rs/core"; 

// You can use variable fonts with Takumi!
// Takumi comes with full axis Geist and Geist Mono by default, 
// if this is what you want, you can just remove fonts array.
const  = [
  {
    : "Inter",
    : await ("/fonts/Inter-Regular.ttf").(() => .()),
    : "normal" as ,
    : 400
  }
];

const  = await (< ="Satori" />, { 
  , 
}); 
const  = new ().render().asPng(); 

const  = new ({ 
  , 
}); 

const  = await (< ="Takumi" />); 
const  = await .(, { 
  : 1200, 
  : 630, 
  : "png", // "webp" is recommended as well.
}); 

function ({  }: { : string }) {
  return (
    <>
      <>Hello from {}!</>
    </>
  );
}

Now you have Takumi setup!

If theres any issues or unexpected behavior, please open an issue on our GitHub repository.

Edit on GitHub

Last updated on

On this page