image hashes



Hi,

could f-spot store a hash (say SHA1) of each photo in the database? This
would help f-spot recognise images even if their filename+path is
changed.  It could be of use in 3rd party programs too.  for example:

I have a big directory structure of photos on my home computer which
I've imported into f-spot and set some tags and descriptions etc.  So
now I have an sqlite database with all this info in, identifying photos
by their path and filename.

I sftp upload a selection of these photos to my web host.  Now all these
images have a different file path (especially as I choose not to have
anything like the same hierarchy on my web host).

I'd like to write a web gallery for my uploaded photos, and use the
f-spot database for metadata.  If the sqlite database had hashes in, I
could upload my photo.db and run a python script which would match up
the new filepaths.

I realise this is rather a specialist setup, but I'm sure the hash would
be useful for other things (I'd like to see f-spot recognise duplicates
on import and keep their metadata in sync, for example).  My guess would
be the overhead would be minimal, as each image ends up in the
page-cache anyway from the thumbnailing process.

I've hacked up an sin-ugly patch to give me a SHA1 hash for testing
(attached).  (It's my first ever c# code and I know very little about
how f-spot works tbh).  It generates the hash in the Create method of
PhotoStore (which is probably the wrong place to do it) and opens the
file an additional time (which is probably unnecessary).

To test my patch you'll need to alter your table structure to add the
'digest' field to the 'photos' table (or kill your photos.db and it'll
create a correct new schema).

It might not have to be a cryptographic hash, it could just be some
other unique identifier that can be derived from the image file.  Exif
seems to have a unique ID field, but I've not found a photo containing
one yet.

Any thoughts?

Thanks in advance,

John.
http://johnleach.co.uk/photography/

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]