hydrus
hydrus copied to clipboard
Mark the parts of the images with the highest difference
Mark the parts of the images with the highest difference when doing dupe filtering.
https://online-image-comparison.com/img/example_image_comparison_unmodified.jpg
https://online-image-comparison.com/img/example_image_comparison_modified.jpg
From https://github.com/hydrusnetwork/hydrus/issues/650 by @Azriel-Satan
I'm sure anyone with a reasonably sized DB has come across a situation when they cant identify any discernible difference between two images but they are reported as not identical, it could be extremely helpful in these situations to be able to enable a difference blending mode to show the pixels that are not in both images.
Of course it would be difficult to implement this on images of different resolutions but it would still be extremely helpful if it was at-least available in instances where the two images are the same resolutions.
It's worth nothing that Suika's post is from a site that uses ImageMagick, which has a Python binding called PythonMagick.
Also worth noting that these sorts of markings could be calculated ad-hoc rather than precalculated like everything else is. The UX could be that the user clicks a button in the right-hand side menu that will compare the two images using PythonMagick, then display the result, maybe in a pop-up. This result image would be put in /tmp
or whatever, not stored in the db. With that said, I don't know enough about ImageMagick to say for sure exactly what arguments the diff generation should use by default. But here's their docs on what the tool can do: https://imagemagick.org/script/compare.php
Because being able to see areas where images are different is something I now have to do on at least a weekly basis, I ended up installing imagemagick and exiftool on my mac and wrote this shell function and put it in my zshrc (but it should be bash-compatible.) The way I invoke it is by using the button in hydrus that sends a pair of potential dupes to the media viewer, then closing the dupe filter, copying the paths to the files, and using them as arguments to this function in a terminal window. Sharing it here because people who might be finding this issue and badly wanting a workaround might find it useful. Install the same deps I mentioned, figure out how to do the open
equivalent for your OS, and you're good to go. Obviously, not nearly as good as having it in-client, but better than nothing.
imgdiff () {
local imgA="${1:?need two images}"
local imgB="${2:?need two images}"
local imgdiff_dir
diff_dir="$(mktemp -d)"
compare "${imgA}" "${imgB}" "${diff_dir}/diff.png"
exiftool "${imgA}" > "${diff_dir}/a.txt"
exiftool "${imgB}" > "${diff_dir}/b.txt"
open "${diff_dir}/diff.png"
diff -c "${diff_dir}/a.txt" "${diff_dir}/b.txt"
}