Square Thoughts

an engineering student's blog

Archive for the tag “raspberry pi”

Using Scrot (SCReenshOT) and Screen Grabs on the Raspberry Pi

While writing posts for my Raspberry Pi tutorials, I needed an easy and lightweight application to capture screen content. There are many options available for Linux including Gimp, gnome-screenshot and KSnapshot for KDE but I wanted something which I could use through the command line (because I just started scripting and it is kind of cool to throw commands at the terminal). So I grabbed the install package for Scrot (SCReenshOT) and started experimenting with it. It is lightweight, about 800kB and is customisable to store images in a variety of formats and resolutions.

Downloading the package

Open a terminal window and write

sudo apt-get install scrot

and provide the user password. Application data will be downloaded and Scrot installed.

Invoking Scrot

The application can be called from the terminal by calling

scrot [option] [argument]

where argument is the target file name. If an argument isn’t provided, a date-stamped file will be saved in the working directory.

Using Scrot

To capture the whole screen after a delay of 1 second and save it with the name “image.png” write (Here “1” denotes the time delay in seconds. You may increase it if you want to arrange windows on your screen before taking a snapshot)

scrot -d 1 image.png
Full Screen Capture

Full Screen Capture

To capture a selected window or selected portion of the screen use

scrot -s image.png
Selected window capture

Selected window capture

 

Arbitrary Screen Capture

Arbitrary Screen Capture

Need more information? Use the command

man scrot

for a list of available options.

 

Raspberry Pi 101 – Lesson 1 – Getting Started

A credit card sized board with a Broadcom 700MHz ARM11 processor, 512MB of RAM, a dedicated GPU, USB 2.0, Ethernet, HDMI, Composite Out and OTG. Intended to be used as a tool to teach computer programming to school students, the Raspberry Pi has been put to many applications outside the classroom. Being relatively cheap compared to other single board computers, Raspberry Pi makes it possible to afford failure.

After all the buzz surrounding the Pi, I recently bought a board for myself, the Model B, Revision 2.0. It came in a small box which much to my delight was the colour of raspberries. I will be using the term “Raspberry Pi”, “Raspi” and “Pi” interchangeably in this post.

It indeed comes in a box which is the colour of raspberries.

It indeed comes in a box which is the colour of raspberries.

Unfortunately, using the Raspberry Pi isn’t an out-of-the-box affair. There are certain hardware prerequisites which need to be met before the Raspi can be put to use. This post is an introduction to the Raspi and the minimum hardware you will need to get the Pi up and running.

Things you will need,

  1. 5V DC adapter with a microUSB plug – The Pi receives power from a 5V DC adapter which connects to the onboard microUSB plug. The recommended power adapter for the Pi is rated at 5V, 700mA (preferably 1A). You may use your mobile phone charger after confirming its rating and load characteristics. Some cheap chargers although rated appropriately fail to deliver the maximum current at the fixed voltage of 5V. So choose accordingly. The charger I am using for my set up is repurposed from an old Samsung mobile phone and is rated at 5V and 800mA.
  2. USB Keyboard and Mouse – As the Pi runs customised Linux distributions and majority of user interactions either take place using the terminal or the GUI, a keyboard and a mouse is indispensable. These connect to the onboard USB ports on the Pi. I am using a Logitech MK200 USB keyboard and mouse.
  3. SD Card – The operating system image running on the Raspi is stored on an external SD card. The minimum required SD card for stable operation of the Pi is a 4GB Class 4 SD card. Class 6 and Class 10 cards are known to have not performed well with the Pi. You can also use a microSD card with a SD card adapter. I am using a SanDisk 16GB microSD card with a Kingston SD card adapter.
  4. A High Definition TV with HDMI input or a standard TV set with composite video input – The Raspi is capable of generating full HD 1080p graphics using the onboard GPU. To fully achieve the graphical capabilities of the Pi you will need a HDTV/monitor with an HDMI input. However, you may also use the composite video out on the Pi with loss in resolution in conjunction with a standard TV set. I am using a Samsung S22B370H LED monitor with my Pi.

Apart from the above things, you may need,

  1. Ethernet Cable – The Pi supports 10/100 Ethernet (RJ45). So if you want to connect your Pi to the internet use an ethernet cable to attach your Pi to the internet router or a laptop with internet sharing enabled.
  2. USB Hub – Since you have utilized all the available USB ports available on the board by connecting the keyboard and mouse, you require a USB hub if you wish to connect other USB devices to the Pi.
  3. Protective Case – Careless removal of cords and uneven installation of the SD card may spoil board contacts and since it is a six layer board, debugging track failures becomes difficult. So enclosing your Raspberry Pi in a protective casing prevents it from such unforeseen damages.
  4. Multiple SD cards – As the Pi boots the operating system image from an external SD card you may wish to keep several SD cards with different install images handy for easy swapping of operating systems.

That’s it for now. I will write more on how to set up your SD card with an operating system image in the next post.

Post Navigation