Use Imgur-Screenshot to Take a Screenshot and Upload It to Imgur in One Go [Linux]

When you’re working remotely with your team or discussing something with your friend over the Internet, a situation might arise where you’re required to take a screenshot and share it with the person on the other end. While the most common way is to send the screenshot through the chat or messenger app you’re using, there are many other solutions that make this process fast and convenient.

In this article we’ll learn aout a tool, Imgur-Screenshot, that allows you to capture a screenshot and upload it to image-sharing website Imgur in one go – this way you’ll just have to share a link.

Note: Imgur-screenshot works in Mac OS X, too.

The Imgur-Screenshot tool is basically a simple bash script available for Linux and OS X. The tool, which is even listed on Imgur’s official website, lets you take screenshot of a selected area and then upload the image to Imgur – all this happens in a single step. Not only this, a direct link to the image is also copied to your clipboard for you to use.

To download the Imgur-screenshot tool, run the following command (Make sure git is already installed in your system.):

git clone https://github.com/jomo/imgur-screenshot.git

This will download the bash script to your Home directory. For example, in my case it was downloaded to the “/home/himanshu/imgur-screenshot” directory. Enter this directory, and you can run the tool by executing the “imgur-screenshot.sh” script.

But before you start using the tool, first check whether all its dependencies are met by running the following command:

./imgur-screenshot.sh --check

And if any dependency is unmet, you’ll have to install it first. For example, in my case the following output was produced:

OK: found grep
OK: found notify-send
OK: found scrot
ERROR: xclip not found
ERROR: curl not found

This meant I had to download the last two packages before starting with Imgur-Screenshot.

In its most basic form the tool can be used by just running it as a normal shell script. Once run this way, it will ask you to first select an area that you want to capture.

./imgur-screenshot.sh 
Please select area

Once you select the area with your mouse, the screenshot will be captured, and the uploading process will immediately begin.

Uploading '/home/himanshu/Pictures/imgur-2016_04_27-12:47:41.png'...
 
image  link: https://i.imgur.com/z8Wkxq7.png
delete link: https://imgur.com/delete/mhVokN54tNmXbnf
URL copied to clipboard
Opening 'xdg-open https://i.imgur.com/z8Wkxq7.png'
 
Version v1.7.3 is up to date.

Once the upload is done, the target link is copied to the clipboard for your use. Also, the link is automatically opened in a new Web browser tab for you.

Upload the screenshot to your Imgur account

If you have an Imgur account and want your screenshot to be uploaded there, here is how to do it.

Make sure you’re logged into your Imgur account. Then run the following command – its output lists all the steps required to connect the utility with your Imgur account.

./imgur-screenshot.sh -c
In order to upload to your account, register a new application at:
https://api.imgur.com/oauth2/addclient
Select 'OAuth 2 authorization without a callback URL'
Then, set the imgur_acct_key (Client ID) and imgur_secret in your config.

Go to the link mentioned in the output and fill in the information as directed – you’ll have to input your email address as well, but there is no need to enter “Authorization callback URL,” “Application website,” or “Description.” Fill in the captcha at the bottom, and hit the Submit button.

imgur-screenshot-register-application

Next up, allow the application to connect to your account.

imgur-screenshot-client-access-auth

Once you “allow” it, you’ll be given access to your Client ID and Client Secret.

imgur-screenshot-client-register-success-blurd

Copy these values and paste them as values to the “imgur_accnt_key” and “imgur_secret” fields in the “imgur-screenshot.sh” script.

imgur-screenshot-key-secret-enter

Note that it’s a small change, so we did it here. If you’re planning to make several changes to the tool’s configuration (which could happen when you start using the tool frequently), it’s better to override the config in “~/.config/imgur-screenshot/settings.conf.”

Once you’re done with this, run the following command:

./imgur-screenshot.sh -c

If everything has been done correctly until this point, the output will ask you to go to a particular URL and fetch a pin from there.

Here’s the output in my case (I’ve obscured the URL; don’t try to copy it.):

Go to
https://api.imgur.com/oauth2/authorize?client_id=XXXXXXXXXXXXX
and grant access to this application.
Enter the PIN:

imgur-screenshot-auth-pin-blurd

Once the pin is entered, the tool gets connected to your account. To take a screenshot and upload it to your Imgur account, just run the following command:

./imgur-screenshot.sh -l true

Check your account, and you’ll see the screenshot there.

Here are some of the features that the Imgur-Screenshot tool provides:

  • Upload screenshot or image files
  • Copy link to clipboard
  • Customizable configuration
  • Edit image before uploading
  • Upload anonymously or with account
  • Create and add to albums
  • Filename, link, and deletion link history stored
  • Automatic image deletion
  • Update notifications

More info here.

Imgur-Screenshot is an extremely useful tool which does what it promises. Plus, all those extra features make it a must-have. Go ahead and give it a try. Did you know that Shutter (a similar but comparatively more popular tool) seems to have stopped working with Ubuntu recently? It’s another reason to start learning Imgur-Screenshot.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.