Hello Folks!

I have worked on a project where websites were migrated from one server to another. Our team clicked with an idea to take screenshot of website before moving and after running it on new server.

This will help us to confirm that website works and looks the same after movement. We can be sure that websites are not broken. For this, we were searching for some tool that can be run from Linux command line to take screenshot of website.

CutyCapt is the one that came to the rescue. It is available in Ubuntu’s repository and is quick to use. Let us see how to use it.

$ sudo apt-get install cutycapt

$ cutycapt --url=https://www.apexoutlook.com --out=apexoutlook.png

$ file apexoutlook.png 
apexoutlook.png: PNG image data, 800 x 1919, 8-bit/color RGBA, non-interlaced

$ ls -lh apexoutlook.png 
-rw-rw-r-- 1 himanshug himanshug 263K Jun 29 20:27 apexoutlook.png

By default it renders page in width of 800px and captures the entire height of the webpage. You can see apexoutlook.com is rendered in mobile view instead of desktop view.

Apex Outlook Mobile View

To render desktop view, we can specify the width explicitly.

$ cutycapt --min-width=1200px --url=https://www.apexoutlook.com --out=apexoutlook.png
ApexOutlook Desktop View

But usually server has no display hardware attached to it and thereby cutycapt throws this error “cannot connect to X server”. To remedy this, there is a virual framebuffer X server.

Install xvfb and xauth to run a virtual X server.

sudo apt-get install xvfb xauth

xvfb-run --server-args="-screen 0, 1280x1200x24" cutycapt --url=https://www.apexoutlook.com --out=apexoutlook.png --min-width=1200px

This was the one that helped us in the project. Apart from this, I found that firefox can be used to take screenshot from command line. My primary and favorite browser is Firefox.

$ firefox -screenshot apexoutlook.png https://www.apexoutlook.com

Hope you will find this useful for your projects.

Have a nice day!


Hey Friends, Thank you for visiting my blog and spending some time reading it. Myself Aryan who works in computer technologies and keeps on pen down my understanding of various topics. This blog is a write-up of my understanding of various technologies after reading different materials about it. I hope that it helps you in some way.


Leave a Reply

Your email address will not be published. Required fields are marked *