Okay, following up on earlier discussion: I think I have a reasonable
way of dealing with the jpeg-exif stuff until Raphael's metadata code
arrives.  Raphael's plan is to turn everything into XMP and store it
all in a single parasite.  The interface between the jpeg plug-in and
the metadata system, so far as exif is concerned, would consist of two
functions, gimp_metadata_store_exif() -- which translates the exif
into XMP and adds it to the metadata parasite -- and
gimp_metadata_generate_exif(), which constructs an ExifData struct
using the information from the metadata.  (Raphael's plan has them
implemented as plug-ins, but I think that's too awkward.)

I rewrote the jpeg plugin to use those two interfaces. As I now have
it written, here is what it does:  

On loading an exif-jpeg file, it (1) calls
gimp_metadata_store_exif(), and (2) extracts the orientation from
the exif and, if it is not top-left, queries the user whether to
rotate the image.

On saving an exif-jpeg file, it (1) calls
gimp_metadata_generate_exif(), and (2) sets the correct values for
fields that according to the exif specs should be modified when an
image is saved, including the thumbnail, image dimensions,
orientation, etc.

It won't be possible to fully implement the two interface functions,
gimp_metadata_store_exif() and gimp_metadata_generate_exif(), until
Raphael's XMP parsing/formatting code is in CVS -- and even then it
will be a lot of work.  In the meantime, I created temporary
implementations that do the following:

gimp_metadata_store_exif() serializes the exif data and attaches it to
the image as an "exif-data" parasite.

gimp_metadata_generate_exif() extracts the contents of the "exif-data"
parasite and deserializes them.

That is, the two functions combine to handle the exif data in the same
way that it has been handled in the past.  I put the code for the two
functions (and a few small utility functions) into a new file called
gimpexif.c in the jpeg directory.  This should eventually go into a
new metadata library, but it can live in the jpeg directory for a

So, to sum up, I believe that my code makes the jpeg plug-in handle
exif data correctly, and interface correctly with Raphael's system.
It no longer creates any parasites except "exif-data"  -- which means
that there is no way to edit the exif data until Raphael's editor is
available, but so be it.  Future development consists of implementing
the two interface functions so that they actually translate to and
from XMP, and implementing the metadata editor.  

I've tried to put this together in a way that meets all concerns, but
I'm perfectly happy to make further changes if there would be better
ways of doing things.

  -- Bill

______________ ______________ ______________ ______________
Sent via the CNPRC Email system at primate.ucdavis.edu

Gimp-developer mailing list

Reply via email to