[KimDaBa] Scraping new EXIF dates on "old" images

Shawn Willden shawn-kimdaba at willden.org
Fri Feb 27 06:24:06 GMT 2004

Hash: SHA1

On Thursday 26 February 2004 10:53 pm, Jody Harris wrote:
> In retrospect, I could scrape index.xml for the dates, get the EXIF
> dates with metacam or ImageMagick, "whoop a little" search and replace
> on it and be "done before desert."

I did it a different way, dunno if it's more or less nasty, but it was 
definitely easier... I hacked KimDaBa to load EXIF dates from all files, 
regardless of whether they were new or not.  After running this hacked 
version once, I then reverted back to the official source... but now my 
images all have dates in index.xml.

The hack is very simple:  Just edit imageinfo.cpp, take the EXIF reading code 
from ImageInfo::ImageInfo(const QString& fileName) and paste it into 
ImageInfo::ImageInfo( const QString& fileName, QDomElement elm).  I actually 
did it a bit more nicely, factoring out the EXIF stuff into a separate method 
(readEXIF) and making an attempt to distinguish between images whose dates 
were probably gotten from the file timestamps (and should therefore be 
replaced with EXIF data, if any) and images whose dates had probably been set 
manually (and should therefore not be touched).  I also tweaked it no not 
override my rotation info with the EXIF stuff, because my camera doesn't have 
an orientation sensor so that would have unrotated all of my images.  Other 
than the rotation bit, none of the niceness was really necessary.

This is obviously not a general solution, but if you're thinking about hacking 
out some one-use code to solve it anyway, I think this approach is quicker 
than parsing and rewriting the XML; after all, KimDaBa already knows how to 
do that.

Good luck!

Version: GnuPG v1.2.4 (GNU/Linux)


More information about the Kphotoalbum mailing list