You are not logged in.

#1 2014-03-01 23:37:36

edumstpu
Member
Registered: 2013-03-05
Posts: 10

Image Metadata Editor

I have been looking for inserting descriptions into my pictures. Unfortunately, there isn't any option to edit Metadata in File Explorers (I tried Thunar and Nautilus). I wouldn't like to have a photo gallery software just to do that, and, by the way, I couldn't find any of those that allows me to edit metadata in a straight-forward way. I have to navigate through a lot of menus in order to do that.

Basically, I was looking for a plugin or other software that enhanced the "Image" tab on Thunar, so I could see and edit all file metadata there. Honestly, I don't know how do you guys keep your photo albums organized without this feature.

Offline

#2 2014-03-02 00:22:37

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Image Metadata Editor

ImageMagick should be capable to do this, although you have not specified what type of images you want to edit. It may not work for certain types. I tested these on pngs.
To read metadata use:

identify -verbose FILE

To write metadata use:

convert INFILE -set Title "Metadata title" OUTFILE

And yes it is a shell utility, that should actually help in large collections, because you can script. You could get a list of files you want to edit in one column and set their title in a second one, parse both from a script.

Offline

#3 2014-03-03 04:52:10

monodromy
Member
Registered: 2014-02-08
Posts: 60

Re: Image Metadata Editor

I've found Shotwell pretty straightforward to edit tags. However, I personally also use feh + dmenu + a script I found somewhere to view and edit metadata. The latter method I find quite speedy when I've imported a bunch of photos. The script is

image-metadata.sh:

#!/bin/bash
if [ $# -lt 2 ]
then
    echo -e usage: "$0 <action> <filename>\n actions: edit-comment, edit-tags"
    exit -1
fi

action=$1
file=$2

if [ "$action" == "edit-comment" ]
then
    commentText=$(echo | dmenu -t "$(exiv2 -Pt -g Exif.Photo.UserComment $file)")
    if [ $? -ne 1 ] # not aborted
    then
	if [ -z "$commentText" ] 
	then
	    exiv2 -M"del Exif.Photo.UserComment" $file
	else
	    exiv2 -M"set Exif.Photo.UserComment $commentText" $file
	fi
    fi
fi

if [ "$action" == "edit-tags" ]
then
    exiv2 -Pt -g Iptc.Application2.Keywords $file > /tmp/._image_keywords.txt

    selection=$(exiv2 -Pt -g Iptc.Application2.Keywords $file | dmenu -sb "#000" -nf "#aaa" -nb "#222" -sf "#509ba6" -fn 'Deja Vu Sans Mono-14:bold' -l 10)
    if [ -n "$selection" ] 
    then
	exiv2 -M "del Iptc.Application2.Keywords" $file
	while read keyword
	do
	    if [ "$selection" != "$keyword" ]
	    then
		exiv2 -M "add Iptc.Application2.Keywords String $keyword" $file
	    else
		deleted=true
	    fi
	done < /tmp/._image_keywords.txt

	if [ -z $deleted ]
	then
	    exiv2 -M "add Iptc.Application2.Keywords String $selection" $file
	fi
    fi
    rm /tmp/._image_keywords.txt
fi
if [ "$action" == "show" ]
then
    comment=$(exiv2 -Pt -g Exif.Photo.UserComment $file)
    exiv2 -Pt -g Iptc.Application2.Keywords $file > /tmp/._image_keywords.txt
    echo -n Comment: $comment, "Keywords: "
    first=true
    while read keyword
    do
	if [ $first == "false" ]
	then
	    echo -n ", "
	fi
	echo -n $keyword
	first="false"
    done < /tmp/._image_keywords.txt
    echo
    rm /tmp/._image_keywords.txt
fi

It requires exiv2, iptc, and dmenu. (Also ttf-dejavu, but you can edit out that font choice smile) The script is not mine; unfortunately, I cannot remember where I found it.

Then in .config/feh/themes, put

tag --action2 ";/path/to/image-metadata.sh edit-comment %f" --action1 ";/path/to/image-metadata.sh edit-tags %f" --info "/path/to/image-metadata.sh show %f"

Browse pictures with "feh -Ttag *.jpg" for instance, then press 1 to edit tags, press 2 to edit comments.

Offline

Board footer

Powered by FluxBB