Saying stuff about stuff.

The Return of Screamshot

Screamshot is an HTTP screenshot service I first released back in 2016. Although light on features it served its purpose before suffering from the usual bitrot, but I’ve finally resurrected the project and updated it to meet my current needs.

The biggest change is that Screamshot now uses Chrome. Back in 2016 I found PhantomJS to be the most convenient headless browser to run — especially on Heroku — but headless browsers have moved on greatly over the intervening years and it was deprecated soon after the release of headless Chrome in mid 2017.

I’ve added some options that were missing from the previous version like being able to specify the size of the window/viewport, the scale of the image to capture (retina/devicePixelRatio), and whether to capture the full page. But my favourite addition is prefers-reduced-motion=reduce which can be used as a standards-based hint to the page to disable animations that might otherwise be visually problematic in a static screenshot. Screenshot services often include a delay option that can be used (or abused) to wait for animations to finish but if you support prefers-reduced-motion=reduce in your pages then you can prevent animations from running in the first place which not only makes taking a screenshot easier but can also aid accessibility — win win.

Another big difference is that I’ve added a much more comprehensive test suite which will make the project easier to maintain and help prevent further bitrot. The app now includes a set of tests that exercise the entire stack and verify that everything is working as expected by checking a few key pixels in the captured images.

As ever the source is on GitHub and pull requests are welcome. It’s a surprisingly small amount of code for the functionality it provides but that’s because it rests on a heap of great open source libraries like ferrum, rack, sinatra, and capybara to name just a few.