@compai/og

Take an image and resize it to standard sizes for social sharing and open graph images.

Usage no npm install needed!

<script type="module">
  import compaiOg from 'https://cdn.skypack.dev/@compai/og';
</script>

README

@compai/open-graph

Take an image and resize it to standard sizes for social sharing and open graph images.

Installation

yarn add @compai/open-graph

Usage

import fs from 'fs'
import { resize } from '@compai/open-graph'

const IMG_URL = 'https://www.compai.pub/v1/png/93fd9a934120dc5ce1691b0d3e1918694b9d33c0b122b7f07ea7a65137fafc18'

(async () => {
  const imgs = await resize(IMG_URL)

  imgs.forEach(img => {
    fs.writeFileSync(`${img.height}x${img.width}.png`, img.img)
  })

  fs.writeFileSync('test.png', png)
})()

OSS by Components AI.