8

I don't like the GUI way of taking screenshot,uploading it to imgur and get the uploaded link.

So what can I do to take a screenshot of my Ubuntu desktop, upload the screenshot to imgur.com and then get back the uploaded link from terminal?

All I have to do from terminal.

Seth
  • 58,122
Avinash Raj
  • 78,556

3 Answers3

11

Take the screenshot of your desktop

gnome-screenshot was the default command-line tool on Ubuntu to take a screenshot.

gnome-screenshot -d 10

Delayed the screenshot action by 10 seconds,So that you can place the desired window on front within 10 seconds.The taken images are actually stored in ~/Pictures folder.

Upload the image to imgur.com

gedit ~/.bashrc

Add the below lines to the opened .bashrc file and then save it.

imgur() {
    for i in "$@"; do
        curl -# -F "image"=@"$i" -F "key"="4907fcd89e761c6b07eeb8292d5a9b2a" imgur.com/api/upload.xml|\
        grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<\(.*\)>/\x1B[0;34m\1:\x1B[0m /'
    done
}

Source the .bashrc file,so that the changes can take effect,

source ~/.bashrc

The above script requires curl package to work.So install it by running

sudo apt-get install curl

Then run the below command to upload the image stored in the ~/Pictures folder to imgur.com,

imgur ~/Pictures/filename.png

Get the link of uploaded image

enter image description here

Source

user11153
  • 115
  • 1
  • 7
Avinash Raj
  • 78,556
1

If you are using Xubuntu the xfce4-screenshooter-plugin app for the xfce toolbar allows you to link a screenshot to zimagez , as illustrated at http://docs.xfce.org/apps/screenshooter/usage - but you must register for an account there to use it (free and spamfree).

K7AAY
  • 17,202
0

Probably this is what you are looking for. It is more or less the same concept than your own response, but scripted in order to make it really silly and simple.

Use Snap-Share

There is a script called Snap-Share that was ment to feel what you are looking for. What it does exactly? well...

0) Launch it:

1)it takes a picture

2)upload it, and

3) copy the link in your clipboard. All in one move.

See Snap-share working:

In this video you can see how to install the program and how it works :)

Click the image to go to the video! Snap-share video

How to install it:

sudo apt-get install xsel scrot xclip

and then paste this:

mkdir -p ~/.snap-share-install && cd ~/.snap-share-install && wget https://github.com/rhoconlinux/snap-share/archive/master.zip && unzip master.zip && rm master.zip &&  cd snap-share-master/ &&  chmod +x  install.sh && sh install.sh && cd ~ && clear

Then run it with your favourite launcher. The application is called snap-share. :)

Hope it is useful.

Note. this was made mainly for personal use, it is an alpha version. I don't why but randomly from time to time (not allways) the link is mixed with some other things in the clipboard if you take more than three snaps, I don't know why or how to solve it yet. Any help appreciated.

Project Page: https://github.com/rhoconlinux/snap-share

Rho
  • 1,204
  • 1
  • 12
  • 21