[Digikam-users] Not completely but a bit off topic question: looking for texteditor with macro capabillity

Jean-Fran├žois Rabasse jean-francois.rabasse at wanadoo.fr
Mon Aug 29 23:34:20 BST 2011


On Mon, 29 Aug 2011, sleepless wrote:

> Hi,
> One more question. I can imagine that someone got annoyed by this discussion 
> in the wrong place, so I decided not to go on with it. But maybe someone has 
> a great tip where to discuss bash scripting and maybe after that emacs. After 
> all I need to stay productive in Linux and eventually I want to do whatever 
> comes in my mind, as I could in good old dos, with just a snap of my fingers
>
> I have been looking around but could not all by myself really find what fits 
> my needs. For example: fora where questions have 678 views and zero answers, 
> or fora only suited for people who have been digging in to Linux for years.

Hello,

I'm a very new digiKam user, less than two months, but I'm a Unixian
since 1980, over 30 years ! And I'm totaly convinced that scripting,
bash, or Perl, or Python et al., is an (almost) everyday powerful tool
in Unices environments. Whatever application, user oriented with GUI,
you use, you can always open an extra terminal window and do with a few
script lines a lot of stupid and annoying things in a few seconds.
Scripting gives powerful ways to handle files, and gives access to
hundreds of Unix/Linux command line tools.

Wish a fresh example ?
Ten days ago, I came back from holidays with about 400 pictures in my
camera. Too bad but my camera is Nikon and my digiKam version (1.2.0
with exiv2 library 0.19) makes rewriting metadata awfully slow.
(I've timed rewriting data for one image : on my PC, 0.02 sec for
a non Nikon image file, and 6.55 sec for a Nikon image, thus a factor
of 327 !!! Unuseable.)
This topic has been discussed here, and the solution is : upgrade
exiv2 to version 0.20 or 0.21.
If you can. I can't because of the snowball effect, recompile a new
exiv2 library, then recompile digiKam and others things that used the 
previous one and don't start any more, and recompile parts of KDE.
Hum, I prefer to be patient and wait for my distribution to be up to
date and consistent.

The quick and temporay solution is bash scripting.
As I don't use the Exif Makernotes every day (far from that), I decided
to remove these notes. Not destroy, remove and save apart.
I wrote a small script, let's call it "removenotes" :

#!/bin/bash
#
for FILE in $*
do
     exiftool -g ${FILE} > ${FILE}.metadata
     exiftool -b -exif:makernotes ${FILE} > ${FILE}.makernotes
     exiftool -q -overwrite_original -exif:makernotes='' ${FILE}
done

That's all. Then, I go into the directory when I moved my SD card
content, about 400 Jpeg files, and just run :
    removenotes *.JPG

In less than 30 sec, I get my images without the Makernotes record
(but all other Exif data) plus a text file with readable Metadata,
just in case, plus a binary dump of the Makernotes record.
(These two extra files total size is less than 20 Kbytes. Compared
to the 8 Mbytes original Jpeg image, disk space isn't an issue.)
And digiKam is happy and very responsive when organising, taging,
etc. Without that dirty trick, I couldn't have done anything.

Just in case I wish, later, to restore full Metainformation in my
files, it's not a problem because of the binary dump kept.
A second script, let's call it "restorenotes"

#!/bin/bash
#
for FILE in $*
do
     exiftool -q -overwrite_original \
        '-exif:makernotes<='${FILE}.makernotes ${FILE}
done

and images files contains Nikon notes again.

My conclusion would be : When you have something stupid to do ten
times, or hundreds or thousands of time, scripting is THE solution.

But that doesn't answer your second question, "Where to discuss
bash scripting ?" Well, I don't think standard forums could be the
solution. Scripting is used in so many contexts that this would
probably require specialised forums covering one application.

And why not a sublist of the digikam-users mailing list ?
Something like digikam-linux-users at ..., where people could discuss
topics covering "how can Linux env. and bash scripting help solving
digiKam related problems".
With a separate list, digiKam users that don't feel concerned by the
Linux platform and tools would be protected from that extra lexical
noise :)

All the best,
Jean-Fran├žois


More information about the Digikam-users mailing list