simbafs / og

statically generate og image in png based on provided information

Home Page:https://www.npmjs.com/package/@simbafs/og

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getOG

statically generate og image in png based on provided information

Installation

$ npm i @simbafs/og

usage

CLI

$ node index.js path/to/your/post.md
Usage: index [options] <input> [output]

Arguments:
  input              the input markdown file
  output             the output png file, default og/${input}

Options:
  --author <name>
  --font <path>
  --template <path>
  -h, --help         display help for command

the generated og image will be placed in og/path/to/your/post.png

Lib

const { getOg, getOgFromMd } = require('@simbafs/og')
const fs = require('fs')

getOg({ 
    title: 'Auto Generate OG Image',
    subtitle: '2023/08/29 by SimbaFs',
    tags: ['og', 'image', 'svg'],
}).then(({ png, svg} => fs.writeFileSync('og.png', png))

// or auto read and write
getOg({
    inFile: 'path/to/your/post.md',
    outFile: 'og.png',
})

og

Batch

To generate og images in batches, you can try my script. I may integratein to this in the future.

Docs

getOg

TODO

getOgFromMd

TODO

About

statically generate og image in png based on provided information

https://www.npmjs.com/package/@simbafs/og

License:MIT License


Languages

Language:JavaScript 100.0%