Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicnocquee/og-screenshots
A CLI to take screenshots of websites and generate open graph images from your own computer.
https://github.com/nicnocquee/og-screenshots
og-image opengraph opengraph-images screenshots
Last synced: 3 months ago
JSON representation
A CLI to take screenshots of websites and generate open graph images from your own computer.
- Host: GitHub
- URL: https://github.com/nicnocquee/og-screenshots
- Owner: nicnocquee
- License: agpl-3.0
- Created: 2024-05-05T13:47:30.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-10T10:16:27.000Z (8 months ago)
- Last Synced: 2024-10-02T07:58:35.404Z (3 months ago)
- Topics: og-image, opengraph, opengraph-images, screenshots
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/og-screenshots
- Size: 1.25 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# og-screenshots [BETA]
A CLI to take screenshots of websites and generate [open graph images](https://ogp.me) from your own computer. Having a website with a screenshot as an open graph image is a great way to promote your website and attract more visitors.
## Why?
- Existing solutions are expensive and subscription based. You usually only need to take the screenshots once. You don't have to pay for a monthly subscription.
- Running your own open graph image generator in the cloud is also expensive. If you use a serverless platform, you'll have to pay for the computing power. If you use a self-hosted server, you'll have to pay for storage and bandwidth.## Features
- Screenshot a single URL
- Capture screenshots of multiple URLs from a sitemap or RSS feed## Requirements
- [Chrome browser](https://www.google.com/chrome/)
- [ImageMagick (convert)](https://formulae.brew.sh/formula/imagemagick)
- [Node.js 16+](https://nodejs.org/en/)Notes:
- **Note that I only tested this on macOS.**
- Chrome is required because I don't want to use [puppeteer](https://pptr.dev). Puppeteer automatically downloads a recent version of Chrome for Testing which can be ~170MB macOS, ~282MB Linux, or ~280MB Windows. That's a lot of bytes for doing just one thing. It turned out that the normal Chrome browser can be used for this task and majority of people already have it installed.## Install
```bash
npm i -g og-screenshots
```Or you can also directly execute the command:
```shell
npx og-screenshots --url "https://example.com"
```## CLI
```
Usage
$ og-screenshots [input]Options
--url, -u Input URL (required). Can be a sitemap, RSS feed or a single URL. When using a sitemap or RSS feed, this command will automatically detect the URLs in the feed or sitemap and process them.
--transform, -t Transform origin [Default: false]
--timeout, -T Timeout in milliseconds [Default: 60000]
--extension, -e File extension [Default: webp]
--concurrency, -c Concurrency level [Default: 3]
--quality, -q Image quality [Default: 100]
--max-screenshots, -m Maximum number of screenshots [Default: 0]
--recommended-size, -r Recommended image size [Default: {"width":1200,"height":630}]
--output-dir, -o Output directory [Default: ./public/screenshots]
--window-size, -w Browser window size [Default: 1300,1300]
--chrome-path Path to Chrome [Default: detected Chrome path]
--imagemagick-path Path to ImageMagick [Default: detected ImageMagick path]
--overwrite Overwrite existing files [Default: false]. By default, the command will not take screenshots if the output file already exists.Examples
$ og-screenshots --url "http://example.com"
```## Development
Run
```bash
npx tsx source/cli.tsx --url "https://example.com"
```## Known issues
- Sometimes the process hangs. You can try to kill the process manually. Anyone who knows how to fix this issue is welcome to contribute.
## License
Affero General Public License v3.0
## Contact
[Nico Prananta](https://twitter.com/2co_p)