Rabarbar – Yet another website screenshot tool

Rabarbar is a simple utility to render a website screenshot. It is the engine behind Miniature.io project.
The application is based on QWebEngine library from Qt toolkit, which is based on Chromium.
Rabarbar can be used as a standalone tool to generate screenshots in your projects.

Rabarbar sources on GitHub: https://github.com/loskoderos/rabarbar

Sample websites captured with Rabarbar

Usage

./rabarbar --url https://github.com --width 640 --height 1136 --out sample.png
./rabarbar --url https://cepa.io --width 1280 --height 1024 --out screenshot.png
./rabarbar --url https://cepa.io --width 1280 --height 1024 --out screenshot.pdf --pdf-orientation=landscape --pdf-paper-size=a4
ParameterRequiredDescription
urlyesWebsite URL address.
outyesOutput filename.
widthnoScreenshot width in pixels, default 1024.
heightnoScreenshot height in pixels, default 1024.
delaynoNumber of seconds to wait before grabbing a shot once the website is fully loaded.
timeoutnoMax wait time for a page to be loaded in seconds.
user-agentnoCustom browser user agent.
referernoCustom referer.
pdf-orientationnoPDF orientation (portrait, landscape).
pdf-paper-sizenoPDF paper size (a3, a4, letter, tabloid).

Prerequisites

This app has been built and tested with Qt6 on Ubuntu 22.

apt-get install build-essential qt6-base-dev qt6-webengine-dev libqt6webenginecore6-bin libqt6opengl6-dev qmake6 xvfb

Building

git clone https://github.com/cepa/rabarbar
cd rabarbar
qmake6
make
./rabarbar --url https://openai.com/ --width 512 --height 512 --out sample.png

Headless

Rabarbar works in headless mode with Xvfb.

xvfb-run -a ./rabarbar --url https://google.com --width 1280 --height 1024 --out screenshot.png

Docker

You can build and run Rabarbar to render websites in Docker.

docker build -t rabarbar .

Run and save screenshot in the local folder.

docker run -v ./:/out rabarbar --url http://openai.com --out /out/openai.png

Notes

  • Referer header can be ignored by Chromium due to internal policies, consider this feature experimental.
  • Code may be built with Qt5 however there were some issues reported with QWebEngine on Ubuntu.

The project and the article has been updated in 2023 to fix minor issues and add Docker build file.

Lukasz Cepowski

Hi! I'm the person behind Los Koderos. Tech stuff aside, love riding motorbikes, 4x4, offroading, exploring outdoors, cooking and tinkering with other DIY projects. Based in Krakow, Poland.