Page 1 of 1
Is it possible to use ImageMagick to find duplicate images?
Posted: 2014-02-11T10:45:02-07:00
by samiejg
Like say for example if I had two files name kitten1.jpg and kitten2.jpg, and they were exactly the same image. is there anything with ImageMagick that will allow me to see if they are the same image?
I'm looking to make a PHP script that uses an "If statement" for if the image is a duplicate.
Re: Is it possible to use ImageMagick to find duplicate imag
Posted: 2014-02-11T10:55:37-07:00
by snibgo
Code: Select all
compare -metric RMSE kitten1.jpg kitten2.jpg NULL:
Re: Is it possible to use ImageMagick to find duplicate imag
Posted: 2014-02-11T11:03:06-07:00
by magick
For identical images, you'll get the same signature:
- identify -verbose kitten.png kitten2.png | grep signature
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
Use -metric PHASH if you want to identify images that are similar or are the same image but resized, cropped, sharpened, etc.
Re: Is it possible to use ImageMagick to find duplicate imag
Posted: 2014-02-11T11:15:21-07:00
by samiejg
magick wrote:For identical images, you'll get the same signature:
- identify -verbose kitten.png kitten2.png | grep signature
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
Use -metric PHASH if you want to identify images that are similar or are the same image but resized, cropped, sharpened, etc.
Thanks a lot guys! This helps me a lot. BTW, I'm assuming grep wouldn't work on Windows? I'm using Xampp. Is there anything equivalent on the Xampp/windows version of imagemagick?
Re: Is it possible to use ImageMagick to find duplicate imag
Posted: 2014-02-11T11:26:27-07:00
by snibgo
Windows doesn't include a grep, but does have "findstr.exe", which can do this job. Of course, many Unix tools have ben ported to Windows.
Re: Is it possible to use ImageMagick to find duplicate imag
Posted: 2014-02-11T11:32:10-07:00
by fmw42
There is a new compare metric as of IM 6.8.8.3 that does a perceptual hash to look for similar or identical images even if scaled. See
http://www.fmwconcepts.com/misc_tests/p ... index.html