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.
Is it possible to use ImageMagick to find duplicate images?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Is it possible to use ImageMagick to find duplicate imag
Code: Select all
compare -metric RMSE kitten1.jpg kitten2.jpg NULL:
snibgo's IM pages: im.snibgo.com
Re: Is it possible to use ImageMagick to find duplicate imag
For identical images, you'll get the same signature:
- identify -verbose kitten.png kitten2.png | grep signature
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
Re: Is it possible to use ImageMagick to find duplicate imag
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?magick wrote:For identical images, you'll get the same signature:
Use -metric PHASH if you want to identify images that are similar or are the same image but resized, cropped, sharpened, etc.
- identify -verbose kitten.png kitten2.png | grep signature
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
signature: 5c701306a9a985a0c93c8d11a1e761d7f863757
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Is it possible to use ImageMagick to find duplicate imag
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.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Is it possible to use ImageMagick to find duplicate imag
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