Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if there is a way to automatically add a given meta-tag to the screen-shots taken on pressing print screen key.

It would really be a time-saver because I upload many screen-shots to my blog regularly. It will avert the need of adding tags manually to all screen-shots.

share|improve this question
up vote 1 down vote accepted

You could map the keyboard shortcut of your choice to a (very) short script that goes something like:

KW="My keyword"

activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
import -window "$activeWinId" $FILENAME -comment $TAGSTRING

# More advanced exif info:
exiftool -keywords=$KW $FILENAME

To make this executable, save it as something like myscreenshot and then do

chmod u+x myscreenshot

Placing it in your ~/bin/ directory and making sure that that is in your path means it will be executable from whatever directory it is called from.

Then depending on your desktop environment you need to map whatever keyboard shortcut you like to the command myscreenshot.

for example in Gnome, select keyboard shortcuts from preferences, and assign a custom shortcut (you decide on the key combination) to the command myscreenshot. If you didn't put the executable in a path on the PATH, then you would have to specify the full path in the command argument, such as '/home/USER/bin/./myscreenshot'


This takes a screenshot of the active window but can be easily modified to take a screenshot of the whole window if that's what you want.


exiftool may also do what you want - perhaps giving more flexibility over the information to store than the comment string alone.

For example

exiftool -keywords=one -keywords=two -keywords=twentythree FILENAME

will add the keywords one, two, and three to FILENAME.

GUI alternative

Also TAGSTRING can either be set in the script file, or perhaps passed in using a simple zenity dialog, depending on if it will be the same each time or you need to be able to change it.

Alternatively, shutter seems to have a lot of customization options (many more than the stock screen capture tool), including upload! See here for more information.

share|improve this answer
Can you elaborate on any one method? I think script will be very convenient. But I do not know how to map it to a keyboard short cut. By the way, I do not want screen-shot of the active window. I want to select an area. – Chirag Jul 25 '12 at 21:57
The mapping is independent of the script itself and depends on which desktop environment you're using. First though you have to make the script executable and declare the relevant variables - I've edited the post to reflect this. – jmetz Jul 25 '12 at 21:58
It's not writing anything when I see properties. Nothing under comments. Weird. – Chirag Jul 25 '12 at 23:01
So you're getting the screenshot ok without comments or tags, is that correct? – jmetz Jul 25 '12 at 23:05
Exactly. That's right. – Chirag Jul 25 '12 at 23:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.