# generate-preview-images

> Automatically take screenshots of static HTML pages to use as preview images for social media.

Latest version **0.3.0** (published 2020-10-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install generate-preview-images
pnpm add generate-preview-images
yarn add generate-preview-images
bun add generate-preview-images
```

Provides the command `generate-preview-images`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2020-10-16 |
| First published | 2020-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | MoritzLost |
| Maintainers | moritzlost |

## Links

- npm: https://www.npmjs.com/package/generate-preview-images
- Repository: https://github.com/MoritzLost/generate-preview-images
- Issues: https://github.com/MoritzLost/generate-preview-images/issues
- npm.io page: https://npm.io/package/generate-preview-images

## Dependencies (6)

- [express](https://npm.io/package/express.md) ^4.17.1
- [imagemin](https://npm.io/package/imagemin.md) ^7.0.1
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.2.4
- [puppeteer](https://npm.io/package/puppeteer.md) ^5.3.1
- [imagemin-optipng](https://npm.io/package/imagemin-optipng.md) ^8.0.0
- [imagemin-jpegtran](https://npm.io/package/imagemin-jpegtran.md) ^7.0.0

## Recent versions

- 0.3.0 (latest) — 2020-10-16
- 0.2.0 — 2020-10-09

## README

# Generate preview images

This is a utility package that allows you to find HTML files in a directory and programmatically take screenshots of them. This is intended mainly for static site generators to generate preview images for social media. Files are served using a static express server, the screenshots are taken through a headless Chrome instance using Puppeteer.

**WARNING: Work in Progress.** This is an unstable alpha release. Not all options are implemented yet.

## Installation

@TODO

## Script usage

```js
// run this AFTER the build step of your static site generator
const path = require('path');
const { generatePreviewImages } = require('/path/to/generate-preview-images/main');

generatePreviewImages(
    // absolute path to your build target directory
    path.resolve(__dirname, '../dist/'),
    // object with options
    {
        // glob pattern to find files to take screenshots of
        globPattern: '**/*.{html,htm}',
        // ...
    }
)
.then(() => process.exit(0))
.catch(e => {
    console.log(e);
    process.exit(1);
});
```

@TODO

## CLI usage

Not implemented yet.

## Usage examples

@TODO

---
_Source: https://npm.io/package/generate-preview-images · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
