Super Quick & Simple Imgur Screenshotting – Debian/Ubuntu

Outcome:
Keyboard shortcut that will allow you to select an area on screen, then one second later the Imgur link is in your clipboard ready to paste.

Steps to install:

1) sudo apt-get install scrot curl zenity xclip
2) Copy the script below into an empty file, save as imgur.sh
3) chmod +x imgur.sh
4) Set a keyboard shortcut to run the script on keypress



#!/bin/bash
screenshot='screenshot';
nano=`date '+%d-%m-%y-%N'`;
extension='.png';
file="$HOME/Desktop/$screenshot-$nano$extension";

sleep 2; scrot -s -b -q 0 $file;

TEXT=$(curl -F "image"=@"$file" -F "key"="5d317f0bee23b282473522e1aa68f621" http://imgur.com/api/upload.xml | grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<\(.*\)>/\1:\ /' | grep "Original" | awk '{print $3}' );

echo $TEXT | xclip;

exit 0



#######END#######

Advertisements

Leave a Reply

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