It’s useful to store informations about photo files such as where a photo was shot and who appears on it. JPEG files have a comment field but it’s surprisingly difficult to find a Linux application to edit them. So I wrote a script, that is easy to integrate with image viewers that support custom actions such as Mirage and GQview.

Here are the instructions to use peanut. First, you’ve got to install pygtk and pyexiv2, through your distribution package manager. Then, download the script and save it somewhere (personnally, I save scripts in /home/pierre/bin/). Make it executable, either through your file navigator or through the command-line (chmod +x peanut). Now, you should be able to run peanut from the command-line, typing peanut FILE, where FILE is a JPEG file.

And to make editing comments even easier, you can set up a custom action in a picture viewer. I describe this for the Mirage image viewer.

A Custom Action in Mirage
Choose Edit -> Custom Actions -> Configure, press the + button to add a new action. Enter a name such as Edit Comment, fill the Command field with the full path to the peanut script followed by %F (for example, /home/pierre/bin/peanut %F), and finally click on the shortcut box and type a key combination that will launch the comment editor (for instance c). Press OK and you’re good to go.

Now, you can browse pictures through Mirage, and type c when you want to edit a comment: the editor will pop up.