CAn any body tell em how to compare two images in Accessc.Actually I have Photo filed filed datatype is oleobject which stores images.Now i want to know how may duplicate images is there.
Thanks in advance
How do you want to compare them, as a binary file or as a side-by-side view of the images? Are the images stored on a file server too? There are plenty of file comparison tools that could parse a directory and give you the results...
answered Sep 28, 2010 at 03:54 AM
You could try generating a hash of the binary data and comparing that for each entry in your table.
As it is Access, you could do that in VB. I have no idea how inefficient that would be though, most probably not very. It would be better to do it as Fatherjack mentioned by using a comparison tool on a directory structure - there are lots of free versions available and most should be fast enough.
answered Sep 28, 2010 at 04:08 AM
I would start off creating a query comparing datasize of the OLE Objects. I believe that can be done using the LenB-function. Create a query that does **GROUP BY LenB(OLEField) HAVING COUNT()>1*. That would limit the number of objects you need to compare.
Next step would be to open the query from a VBA-Module, and compare the rows with identical sizes for the OLE Object.
Comparing two objects can be done by storing them in Byte arrays, and using StrConv function to compare them. Here's a VBA function that could possibly be used for that purpose.
answered Sep 28, 2010 at 06:39 AM
It largely depends on what you mean by compare. If you just want to see if the images are identical in a byte for byte since and you really want to use Access, then I think Magnus has the best answer you will find. With that said, Access is probably not a good tool for this task unless you have some truly compelling reason to use it.
I personally would consider Python where you have access to bsdiff ( http://www.daemonology.net/bsdiff/ ) and difflib ( http://docs.python.org/library/difflib.html ) either of which will provide you a comparison very effeciently and with a minimum of code. C# would also be a good choice for that and Microsoft very helpfully provides a full tutorial for doing it effeciently at http://support.microsoft.com/default.aspx?scid=kb;EN-US;320348
Now, if you mean you want the program to do a sophisticated analysis to tell you the amount of difference, then Access is certainly not the right tool and you will be far outside my knowledge.
And finally, if you want to provide the two pictures side by side so that the user can personally compare them, then just create two image objects in your form. Then you can use VBA to change the images they have. The code to change the image is as simple as:
You can of course include that in a more sophisticated procedure that decide which pictures to show the user.
answered Sep 28, 2010 at 09:28 AM