Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Script-fu scritp to add border with exif data

295 views
Skip to first unread message

Felix

unread,
Jul 4, 2008, 4:04:14 AM7/4/08
to
I've seen that some people add a border to their photos and some
information into it. This information is extracted from the exif
metadata of the photo. I know this is possible to do with photoshop
(http://forums.dpreview.com/forums/read.asp?
forum=1021&message=11882283), but it would be great to do this with
the gimp too. It's possible to do it? I don't find any information
about how to access exif data from a script-fu script.

Floyd L. Davidson

unread,
Jul 4, 2008, 4:52:10 AM7/4/08
to

The scheme implemention for Script-Fu is a bit too
limited, as far as I can determine, to do that.

However, I've used Python to access Exif data (via the
Perl program exiftool) to set the date in a "signature"
script. I'm not exactly an experienced Python programmer,
and it was nothing less than painful to figure out how to
do that...

What exactly would you like to be printed?

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) fl...@apaflo.com

Felix

unread,
Jul 4, 2008, 1:48:17 PM7/4/08
to
On Jul 4, 10:52 am, fl...@apaflo.com (Floyd L. Davidson) wrote:

Finally I do it the bash way :P more natural for me to implement and
understand. I've done a little script with the help of Imagemagick to
add the label with the info I want to show. You can see it <a
href="http://blog.wikifotos.org/2008/07/04/anadir-marco-descriptivo-
con-datos-exif-a-las-fotos/">in this post</a> (sorry I'm Spanish, you
can just ignore the content of the page and take a look to the
script).
Thanks for the help.

Floyd L. Davidson

unread,
Jul 4, 2008, 11:10:11 PM7/4/08
to
Felix <sucot...@gmail.com> wrote:
>Finally I do it the bash way :P more natural for me to implement and
>understand. I've done a little script with the help of Imagemagick to
>add the label with the info I want to show. You can see it <a
>href="http://blog.wikifotos.org/2008/07/04/anadir-marco-descriptivo-
>con-datos-exif-a-las-fotos/">in this post</a> (sorry I'm Spanish, you
>can just ignore the content of the page and take a look to the
>script).
>Thanks for the help.

Bash scripting is certainly an easier way as far as the
programming goes!

One point about your script though, is that "identify" is
extremely slow. If you use "exiftool" to get the information
it is much faster.

Here's a quick revision. (More could be done, but I'm
pressed for time right now.)

#!/bin/bash

if [ $# != 3 ] ; then
echo "Modo de uso: marco_foto.sh foto.jpg 20 \"comentario\""
echo "foto.jpg -> nombre de la foto"
echo "20 -> tamaño de la letra"
echo "\"comentario\" -> comentario de la foto"
exit 1
fi

if ! test -r $1 ; then
echo "Cannot read file: $1"
exit 2
fi

if [ $2 -gt 3 -a $2 -lt 100 ] ; then
SIZE=$2
else
echo "Font size \"$2\" out of range (3 to 100)."
exit 3
fi

TIME=$(exiftool -s -s -s -ExposureTime $1)
MM=$(exiftool -s -s -s -FocalLengthIn35mmFormat $1)
ISO=$(exiftool -s -s -s -ISO $1)
FF=$(exiftool -s -s -s -FNumber $1)

if [ "." != ${1: -4:1} ] ; then
NOMBRE=$1
else
NOMBRE=${1%%${1: -4}}
fi

montage -geometry +0+0 \
-pointsize $SIZE \
-background black \
-fill white \
-label "ISO $ISO \| f\/$FF \| $TIME s \| $MM \n $3" \
$1 ${NOMBRE}_con_marco.jpg

Felix

unread,
Jul 7, 2008, 1:34:01 PM7/7/08
to
On Jul 5, 5:10 am, fl...@apaflo.com (Floyd L. Davidson) wrote:

Thanks for your help. I've added your changes to the script.

Floyd L. Davidson

unread,
Jul 8, 2008, 2:52:57 AM7/8/08
to
Felix <sucot...@gmail.com> wrote:
>Thanks for your help. I've added your changes to the script.

Hi Felix,

I've just put on my web site a GIMP script written in
Python that you might be interested in:

http://web.newsguy.com/floyd_davidson/akforum/signature.py

It is the same basic script that I've been using for a
few months to put a "signature" title on images. But
over the last few days I hacked it to have the ability
to insert Exif data fields in the way you wanted.

It requires that GIMP be compiled to allow use of
Python. Put the script into either the
~/.gimp-2.4/plug-ins/ directory or into the global
plug-ins directory, which probably is either
/usr/local/lib/gimp/2.0/plug-ins/ or
/usr/lib/gimp/2.0/plug-ins/.

Note that while it will run as is, there are some
"defaults" that should be configured. Edit the file and
read the info on what it does, and the first part of the
code is marked as "USER CONFIGURATION AREA" and each
string there should be changed to whatever you want your
default to be.

I sort of threw in the description of what it does and
how to configure it, and I'm not at all sure that it
will make sense to someone else. Also this did involve
a significant amount of new code, which is yet to really
be tested, so expect a bug or two or more. (I'll keep
the web page version updated with any later revisions,
so if this is useful you might want to check back every
few months.)

Here are a couple of images that show what it does. The
first one is what I've been using it for previously. Note
that the white border is done with a different script, and
is not part of this one.

http://web.newsguy.com/floyd_davidson/akforum/1304.s.jpg

The two format control strings were "Barrow, Alaska -- %D" and
"Copyright %Y Floyd L. Davidson, fl...@apaflo.com".

The second one shows what it can do now,

http://web.newsguy.com/floyd_davidson/akforum/d3f_1304a.s.jpg

The two format control strings used used to generate
that title were "f/%A @ %S Seconds, ISO %I with a %l at
%L" and "Copyright %Y %a, %e".

To produce the first one with the new script it could be
left as is, but the defaults that I'm using are "%G -- %D"
and the second one is as shown above.

If you find it useful and want something added or changed,
let me know and I'll see what can be done.

0 new messages