| title | Quickstart |
|---|---|
| description | Start generating your first Open Graph image in minutes |
Choose your package manager and run the following command:
npm install @ogify/core @ogify/templatespnpm add @ogify/core @ogify/templatesyarn add @ogify/core @ogify/templatesThis guide will walk you through generating your first Open Graph image using OGify.
OGify comes with a set of ready-to-use templates. For this guide, we'll use the `basic` template. Browse all available templates at the [Template Gallery](https://ogify.dev/templates).```typescript
import template from '@ogify/templates/basic';
import type { TemplateParams } from '@ogify/templates/basic';
```
```typescript
import { createRenderer } from '@ogify/core';
const renderer = createRenderer<{ basic: TemplateParams }>({
templates: { basic: template },
// Optional: Shared parameters across all templates
sharedParams: {
brandName: 'My Brand',
brandLogo: 'https://ogify.dev/white-logo.svg',
}
});
```
```typescript
const imageBuffer = await renderer.renderToImage('basic', {
title: 'Hello World',
subtitle: 'My first dynamically generated OG image',
layout: 'aligned',
cta: 'Read More',
primaryColor: '#000000',
extras: ['#zero-config', '#production-ready'],
});
```

<AccordionGroup>
<Accordion title="Saving to a File" icon="file-arrow-down">
```typescript
import { writeFile } from 'node:fs/promises';
await writeFile('output.png', imageBuffer);
```
</Accordion>
<Accordion title="Returning as a Response" icon="reply">
```typescript
return new Response(imageBuffer, {
headers: {
'Content-Type': 'image/png',
},
});
```
</Accordion>
</AccordionGroup>