Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vercel/og

Package Overview
Dependencies
Maintainers
9
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/og

Generate Open Graph Images dynamically from HTML/CSS without a browser

  • 0.5.16
  • npm
  • Socket score

Version published
Weekly downloads
129K
decreased by-5.15%
Maintainers
9
Weekly downloads
 
Created

What is @vercel/og?

@vercel/og is a package designed to generate Open Graph images dynamically. It allows developers to create custom social media preview images on the fly using HTML and CSS, which can be particularly useful for generating unique images for each page or post on a website.

What are @vercel/og's main functionalities?

Generate Open Graph Images

This feature allows you to generate Open Graph images dynamically using HTML and CSS. The code sample demonstrates how to create an image with a custom title passed as a query parameter.

const { ImageResponse } = require('@vercel/og');

export default function handler(req, res) {
  const { searchParams } = new URL(req.url, 'http://localhost');
  const title = searchParams.get('title') || 'Default Title';

  const image = new ImageResponse(
    <div style={{
      fontSize: 128,
      color: 'white',
      background: 'black',
      width: '100%',
      height: '100%',
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
    }}>
      {title}
    </div>,
    {
      width: 1200,
      height: 630,
    }
  );

  res.setHeader('Content-Type', 'image/png');
  res.send(image);
}

Other packages similar to @vercel/og

Keywords

FAQs

Package last updated on 20 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc