How to take a screenshot and then upload the image to imgur through terminal?
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
Source
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).