How to do this depends on whether your image files bitwise identical, or only visually similar (e.g. because they might have different comments or been recompressed, cropped...).
If the files are identical, and you can rename them in both the source and your archive, it's easy to rename them to always have the same name. You can keep the old name as a symbolic link. Untested:
for orig in *.jpg; do
canon=$(<"$orig" md5sum | sed 's/ .*//').jpg
mv -i "$orig" "$canon"
ln -s "$canon" "$orig"
done
This assumes your archive is a single directory. If there are subdirectories, you'll need to change *.jpg
to **/*.jpg
(requires bash 4 or zsh), and arrange to add the right amount of ../
to the ln
command.
After this rsync will copy only the content and name of new photos and new names for existing photos.
If you can rename the files only in your archive, you can still arrange something with clever use of symbolic links and probably rsync --copy-unsafe-links
.
If the files are only visually similar, it's more complicated, and there can't be a fully automated answer (between a cropped version and a low-quality version, a human being has to make the choice). Some tools to compare visually similar images may help, e.g. gqview (interactive) or findimagedupes (command line).
Note that since you don't specify your operating system, I've made suggestions that work on mine. They'll work on any unix-like system, including OSX and Cygwin. The symbolic link idea will also work natively on Windows XP and newer (maybe even earlier) but requires installing additional tools.