Share screenshots on the Internet
When communicating on the Internet, it is often necessary to quickly show the other person a screenshot (program window) to help him cope with the problem or solve his problem.
To do this, you can go the long way - save the picture to a file, go to the appropriate hosting, upload the result there, and give the resulting link to the interlocutor. But you can simplify your life as much as possible by once writing a simple script that will do all the routine work.

Since I use KDE, for my own purposes I use the following utilities:
xsnap - for actually taking a screenshot (option - scrot);
uimge - for uploading images to hosting;
kdialog - to display windows and notifications (standard KDE utility, options - xdialog, gtkdialog);
klipper - to place the link on the clipboard (standard KDE utility, options - glipper).
All the action ultimately boils down to invoking the script with a hotkey (you can configure it using your DE), selecting a portion of the screen (or clicking on the desired window) and choosing the right hosting from the list. As a result, a finished link appears in the clipboard.
The bulk of the work is performed by the uimge utility, about which they already wrote on the hub, which is a python script. You can download (including the version for Windows) on the home page , there is also a build file ( ebuild ) for Gentoo Linux.
Everything else is for beauty and convenience.


This was my first topic on Habr.
To do this, you can go the long way - save the picture to a file, go to the appropriate hosting, upload the result there, and give the resulting link to the interlocutor. But you can simplify your life as much as possible by once writing a simple script that will do all the routine work.

Since I use KDE, for my own purposes I use the following utilities:
xsnap - for actually taking a screenshot (option - scrot);
uimge - for uploading images to hosting;
kdialog - to display windows and notifications (standard KDE utility, options - xdialog, gtkdialog);
klipper - to place the link on the clipboard (standard KDE utility, options - glipper).
All the action ultimately boils down to invoking the script with a hotkey (you can configure it using your DE), selecting a portion of the screen (or clicking on the desired window) and choosing the right hosting from the list. As a result, a finished link appears in the clipboard.
#!/bin/sh
rm -f /tmp/xsnap.png
xsnap -fn -misc-*-*-*-*-*-*-*-*-*-*-*-*-* -png -file /tmp/xsnap.png
hosting=$(kdialog --title Uimge --menu "Залить скриншот на:" \
savepic "savepic.ru" \
funkyimg "funkyimg.com" \
smages "smages.com" \
radikal "radikal.ru" \
opicture "opicture.ru" \
ipicture "ipicture.ru" \
upimg "upimg.ru" \
piccy "piccy.info" \
picamatic "picamatic.com" \
keep4u "keep4u.ru" \
4picture "4picture.ru" )
url=$(/usr/bin/uimge --${hosting} /tmp/xsnap.png 2> /dev/null)
if [ "${url}" != "" ]
then qdbus org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents "${url}"
kdialog --passivepopup "Скриншот успешно размещён на сервере"
else kdialog --sorry "Не удалось разместить скриншот на сервере"
fi
* This source code was highlighted with Source Code Highlighter.The bulk of the work is performed by the uimge utility, about which they already wrote on the hub, which is a python script. You can download (including the version for Windows) on the home page , there is also a build file ( ebuild ) for Gentoo Linux.
Everything else is for beauty and convenience.


This was my first topic on Habr.