abcnews / fallback-automation

A fallback image generation service

Home Page:https://fallback-automation.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fallback Automation

A quickly hacked together tool for speeding up the creation of fallback imagery for interactive content by capturing browser output.

Usage

Try it out at https://fallback-automation.now.sh/

It works by loading the page in a headless browser and taking a screenshot of the specified element.

Start by specifying the URL you want to capture fallback images from. The page needs to be accessible from the internet; see the development docs below to run a local copy if you need to capture pages from locally accessible pages.

Then add a list of CSS selectors specifying the elements to capture.

You can (optionally) name the images to be captured. You can also (optionally; default 1200px) specify a browser width at which to capture the images. Captures are made at a device pixel ratio of 2.

Development

To run locally, a local version of the Google Chrome browser is required. It is assumed the browser is installed in the standard location on MacOS or Windows.

git clone https://github.com/abcnews/fallback-automation.git
cd fallback-automation
npm i
npm dev

Authors

Inspiration

This technique was pioneered and demonstrated by Zeit with their og-images service and that's where the hosted version of this runs.

About

A fallback image generation service

https://fallback-automation.now.sh/

License:MIT License


Languages

Language:JavaScript 93.7%Language:HTML 4.5%Language:CSS 1.9%