https://github.com/apex/capture
Lambda function to capture a URL as PNG, JPG, or GIF using PhantomJS
https://github.com/apex/capture
Last synced: 5 months ago
JSON representation
Lambda function to capture a URL as PNG, JPG, or GIF using PhantomJS
- Host: GitHub
- URL: https://github.com/apex/capture
- Owner: apex
- Created: 2016-07-14T04:33:51.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-14T04:34:25.000Z (almost 9 years ago)
- Last Synced: 2024-11-02T13:33:53.524Z (6 months ago)
- Language: JavaScript
- Size: 24.4 MB
- Stars: 108
- Watchers: 9
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# capture
Lambda function to convert a URL to PNG, JPEG, or GIF using PhantomJS.
## Installation
Add capture to your Apex project:
```
$ git submodule add https://github.com/apex/capture.git functions/capture
```Deploy it:
```
$ apex deploy capture
```Try it:
```
$ apex invoke capture < functions/capture/event.json
```## API
Input:
- `url` (string) URL to render
- `format` (string) output format, one of 'png', 'jpeg', or 'gif' (default: 'png')
- `viewport` (object) viewport size with .width and .height (default: 1024x800)
- `clip` (object) clip rect with .top, .left, .width, and .height (default: none)
- `zoom` (number) zoom factor (default: 1)
- `wait` (number) wait time in milliseconds (default: 250)
- `backgroundColor` (string) body background color (default: none)Output:
- `capture` (string) base64 output
## Badges


[](https://apex.sh/ping/)---
> [tjholowaychuk.com](http://tjholowaychuk.com) ·
> GitHub [@tj](https://github.com/tj) ·
> Twitter [@tjholowaychuk](https://twitter.com/tjholowaychuk)