Replacing existing photos in a database

Started by JohnZeman, July 16, 2017, 03:59:35 PM

Previous topic - Next topic


I'm almost embarrassed to ask this question because I've been using IMatch since 2006.  :-[

What's the proper way to replace a photo in the database with a newer version of the same photo so it keeps everything (categories, @keywords, ratings, etc) of the original?

In older versions of IMatch I did all this with a script and it worked great.  Now I'm trying to do it the way we're supposed to do it natively but it doesn't seem to be working for me.


This is a unusual operation.

If you replace a file in the file system, IMatch will re-import the file automatically because it reacts on file system events. And if the file "last modified" differs from the file records in the database, the file will be re-imported. This will also replace all metadata in the database. It will not replace categories or Attributes, except when you perform extra actions during the indexing.

You can protect unwritten metadata via the corresponding options in Edit > Preferences > Metadata, but all non-modified metadata tags in the database will be replaced from what is imported from the file.

If you want ti keep rating and label, just click on the pen in front of the corresponding elements in the MD panel to mark them as "edited". Before you replace the file.

I see no way to do this differently via a script.
-- Mario
IMatch Developer
Forum Administrator  -  Contact & Support - Follow me on 𝕏 - Like on Facebook


That seems to be what's happening all right.

In IMatch 5.8 with the script I simply copied all metadata, categories, etc from the original image in the database to the new one I wanted to replace the original with, then I used IMatch to move the new image to replace the original.  It worked great for me for many years and thousands of photos.

In 2017 I thought I could use copy/paste attributes to copy everything from the original to the new one, but my first test doing that didn't work either in 2017 (always worked in 5.8 though).

The reason I often replace images in my database is because I'll occasionally come across an old photo that I could reprocess better using Photoshop to replace the original in the database with.


Just make sure you have written back all metadata. Then open the file in Photoshop, re-process it and save it. IMatch will re-import it, all metadata will be retained. Attributes and categories as well. This is the normal workflow. Replacing a file in the database with some other file will always cause a reload. But I see no reason for such a workflow when you can just edit the image in question directly in PS.
-- Mario
IMatch Developer
Forum Administrator  -  Contact & Support - Follow me on 𝕏 - Like on Facebook


Ah, that seems to be my problem.  The originals are DNGs in my Lightroom database, I store the processed/exported JPGs from Lightroom > Photoshop in my IMatch database.  So to iMatch it's a new file and not the same one when I want to replace an existing file.


For the reasons Mario described, just replacing the file would/could only work for formats with sidecar files. If all metadata is stored in the XMP sidecar and you leave this one untouched, rereading the metadata should not be harmful. But this is only a special case. Even then you must ensure that there is no pending metadata writeback, or use options to protect unwritten metadata.

Another idea: Import the changed photo in addition to the original already in the database. Use the versioning support of IMatch to copy the metadata, attributes, etc. from the original to the new version. To make this a "replacement" operation, it would be necessary to delete the original  afterwards and maybe even renaming the new version to the name of the original.

I do not know if this is feasible for you. It is not really a smooth operation and depends on how you set up the versioning system.
Win 10 / 64, IMatch 2018, IMA


Thanks Thorsten, I appreciate your thoughts on this too.

It's obvious to me now that I'm going to have to totally rethink my workflow when it comes to replacing existing images in my IMatch database.

The old script method worked perfectly for me for many years but that's no longer an option since I've upgraded.


In case anyone else has a similar situation I've found a solution to my problem.  This works for me because I use @Keywords instead of regular categories and I always writeback everything to the files in my IMatch database.

Here is what seems to work just fine for me.

Export my reprocessed photos from Photoshop putting them in a temporary queue folder in IMatch like I've always done before.  It doesn't matter if they contain any metadata or not.

Run an external ExifTool script to copy everything from the original images in my IMatch database to the newly exported photos in the queue folder.

Import the new photos into IMatch.

Refresh data driven categories and my new replacement images are now fully loaded and can be moved to replace the originals in my IMatch database.