Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to compare images in sql sever after comparing if image can not exist in database secondly store it
Posted
Comments
Member 11465958 10-Mar-15 3:47am    
i am try to compares the images but i can not find solutin
Tomas Takac 10-Mar-15 3:57am    
First of all: what have you tried? Secondly, how would you compare the two images? byte by byte? What is the real requirement behind this?
Member 11465958 10-Mar-15 6:40am    
my requirement is not compare two images compare all images in sql server database..I am trying to built a application which is store the images.. If images already exist in db can not store it..
Member 11465958 10-Mar-15 6:35am    
my requirement is i am trying built a application which store the image in database.. the one codition when image already store in database can not store it....

1 solution

SQL is not good at byte-by-byte comparison: it's forte is data storage, not data processing.

Instead of letting SQL do the work, I would use a hashing algorithm to generate a small, easily comparable code (MD5, or SHA are good for this kind of thing, but even a 32bit byte-by-byte sum would work), store that in my DB along with the image, and compare hash values instead. If you find no identical hashes, the images are all different. If you find two identical hash value,s you can then compare the image data bytes directly in your C# code to check for identical images.

If you want "similar" images, then you are looking at doing all the work in C#: in which case, don't even store the images in your DB: just the path to image files. Otherwise you will waste huge amounts of memory and data bandwidth transferring image data.
 
Share this answer
 
Comments
Member 11465958 10-Mar-15 5:21am    
I am trying many times but i can not do.. please guide step by step how it is possible..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900