Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Comparing images

by SheridanCat (Pilgrim)
on Nov 27, 2006 at 02:32 UTC ( #586174=note: print w/replies, xml ) Need Help??

in reply to Comparing images

You could retrieve and store the MD5 checksum for each image. Check out the Digest::MD5 modules for more on calculating the value. There are caveats to doing it this way - such as getting false positive matches - but it may at least point in a direction you can go.

Replies are listed 'Best First'.
Re^2: Comparing images
by blazar (Canon) on Nov 27, 2006 at 06:59 UTC

    For a ready made solution of mine along these lines, see Re^3: Identical Files to Symbolic Links. It is not focused on images, but on files -like any solution of this kind- but that's what the OP seems to want anyway. BTW: I still plan on rewriting it, but "ASAP" has not come yet. And it's still serving me right for the moment. Go figure!

Re^2: Comparing images
by jimt (Chaplain) on Nov 27, 2006 at 15:01 UTC

    I might be more concerned about false negative matches, but it depends upon what the OP meant by comparing images. You could upload a jpeg of a dog that gets an MD5sum of 00000 (or whatever). I could upload a png of that same photo and that gets an M5sum of ABDEF. Someone else could come along an upload another jpeg at a slightly different compression setting and get an MD5sum of A188F.

    They're all different files, but they all represent the same image. To try and compensate for that, it'd require a more advanced technique like one of the articles linked to later on here in the thread to actually compare upon how the image actually looks, not merely how it's stored.

    Of course, if you just want to make sure the same file isn't uploaded twice, the md5sum should do just fine.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://586174]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2018-04-23 02:26 GMT
Find Nodes?
    Voting Booth?