Capture, upload screenshots from cmdline

image_editor_compThere are numerous GUI screen capture tools (like HotShots) which can upload the images to file hosting services like imgur. What if you want the same action from the cmdline? It’s very much possible. This article explores some cmdline utilities (scripts) which can be used to grab and upload images. Most of these utilities are combinations of utilities controlled from a bash script.

1. Img

Minimalist screenshot uploader bash shell script for imgur. You can select the area of the screen you want to capture. If it succeeds, it copies the image URL to the clipboard and sounds a bell. On failure, it stores the image as well as the error from curl in /tmp. Img depends on scrot, curl and xclip. To install Img with all dependencies on Ubuntu, run:

$ sudo apt-get install scrot curl xclip
$ git clone https://github.com/ceryn/img

To take a screenshot, run:

$ img/img.sh

You can create a handy keybind for img.sh.

2. imgur-screenshot

Similar to Img but supports much more including edit options using ImageMagick. List of features:

  • Upload screenshot or image file
  • Use any screenshot tool
  • Edit image before uploading
  • Upload anonymously or to your imgur account
  • Copy link to clipboard
  • Open uploaded image
  • Delete image from disk after upload
  • Filenames, links and deletion links are stored
  • Automatically delete images after specified time
  • Get notifications about updates

To install on Ubuntu, run:

$ sudo apt-get install imagemagick curl grep libnotify-bin xclip scrot
$ git clone https://github.com/jomo/imgur-screenshot

The configuration file is ~/.config/imgur-screenshot/settings.conf. Generic usage:

$ imgur-screenshot/imgur-screenshot

To explore the options, run:

$ imgur-screenshot/imgur-screenshot -h

3. Bart’s Bash Script Uploader

This one does not capture a screenshot but uploads any image file to imgur. It prints the new URL along with the delete page URL on the console. It also copies the URL to X clipboard. To install, run:

$ sudo apt-get install curl
$ wget http://imgur.com/tools/imgurbash.sh

To upload an image, run:

$ ./imgurbash.sh myimage.jpg

Note that this utility is remarkably extensible. You can write a simple script to capture a screenshot with maim and slop first and then pass the file name to imgurbash.sh to upload it.

4. Gyazo

Relatively new utility written using Ruby and ImageMagick. Gyazo has a few interesting features:

  • Click to capture and release to upload to the Gyazo service. The URL is copied to clipboard.
  • Capture animated GIFs of any area of your screen up to 7 seconds.

Download the Ubuntu package and run the following commands to install:

$ sudo apt-get install ruby imagemagick
$ sudo dpkg -i gyazo_version_all.deb

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s