[Gambas-user] Comparing 2 pictures

Rob sourceforge-raindog2 at ...94...
Mon Aug 10 15:38:02 CEST 2009


On Monday 10 August 2009 08:42 am, Doriano Blengino wrote:
> There is a program called GQView (and probably others) which have
> algorithms to compare two images in the right way - ie scale them to
> same size, compress colors and normalize them, then compare pixel by
> pixel using a good tolerance.
> I did something similar, it is  a pascal source (if I only remember
> where I put it); or you can download those sources and look into them (C
> sources, I suppose).

I did the same thing in Perl about 9 years ago, circa Mandrake 7.  Don't 
know if it would even run with current versions of everything, and it's 
heavily dependent on Imagemagick for the normalizing, but here it is:

http://www.kudla.org/raindog/perl/ 

(see findimagedupes, the first entry on that page)  Also includes someone 
else's C++ implementation of the comparison function which sped it up by 
several orders of magnitude.

But if both pictures are guaranteed to be the same size, something as 
simple as converting each one to text-based PPM format and using diff 
should be sufficient.

Rob





More information about the User mailing list