1

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

It would really be a time saver because I upload many screenshots to my blog regularly. It will avert the need to add tags manually to all screenshots.

1 Answer 1

2

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

#!/bin/sh
FILENAME=~/screenshot.jpg
TAGSTRING="tag:screenshot"
KW="My keyword"

activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
activeWinId=${activeWinLine:40}
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'

NOTE

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

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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .