Ubuntu / Linux news and application reviews.

Based on the Nautilus Actions script and the bash script (see the end of the post) in THIS post, I have created 2 very simple scripts to take a screenshot of your desktop and upload it to Imgur.com, displaying the links (direct link, thumbnail, delete link, etc.).

I made 2 scripts because I wanted a command line and a visual tool for doing this. The scripts were made for my own use, but decided to share them with you.

Here is a video with the "visual" script in action:





The command line script will basically work the same, except you will have to run it in a terminal, and the links to the images will also be displayed in the terminal.


How the scripts work


Like I told you, I have customized them for my own needs, but you can customize them further (very easy).

In their original state, they use "scrot" to take a selection screenshot (you have to select a portion of the screen). I used "scrot" instead of "imagemagick" because there were some issues with the screenshots not being rendered entirely correctly using imagemagick.

Basically, the scripts work like this: you trigger a script (from the command line or you can assign a key), wait 3 seconds, then select an area of the screen or double click a window to take a screenshot of it, and wait for a few moments. The screenshot is then saved on your desktop and uploaded to Imgur, and the links for your new screenshot will be displayed.

Installation and customization


To use the command line script, install the needed packages. In Ubuntu:
sudo apt-get install scrot curl


To install the "visual" script (the URLs will be displayed in a dialog box using Zenity), besides the two packages above, also install zenity:
sudo apt-get install zenity


Then, download either the command line script or the visual script, place it in a folder and use Compiz to set a keyboard shortcut to trigger the script.

Customization


Open a script and look up this:
sleep 3; scrot -s -b -q 0

This is the command that triggers the screenshot, etc.

"sleep 3" - time before taking the screenshot
"-s" - interactively choose a window or rectangle with the mouse
"-b" - when selecting a window, grab wm border too
"-q 0" - the image quality. Note that I've used PNG as the image type, therefore this is actually the image compression level, as the PNGs will have the same quality, no matter the compression.