I want to make sample WinForm C# app for hunting duplicate photos on my laptop.
My question is is there some record, tag ,Exif data or anything else which is unique for JPG(photo) file.
So I can read that data put into data set and hunt for duplicates.
5 Answers
We could say Exif data is unique. This table gives you a good resume of what to get from Exif Data: http://en.wikipedia.org/wiki/Exchangeable_image_file_format#Example
Look at this project, sure the code will help you:
In this stackoveflow question, there is a good answer to get Exif data:
"If you're compiling against v3 of the Framework (or later), then you can load the images using the BitmapSource class, which exposes the EXIF metadata through the Metadata property"
Nevertheless, I would compare name and date, and it must be enough.

- 1
- 1

- 7,602
- 2
- 42
- 69
Why not use the checksum for the file? create a hashtable for all the files you have scanned with the checksum as the key

- 1,177
- 2
- 11
- 22
I would just compare the properties and if they all match then hash the contents and compare.

- 64,563
- 18
- 145
- 216
-
Properties of file ? Are they same even if is file copied from SD in different time intervals – adopilot Oct 21 '10 at 11:04
-
It depends on the program you use, but Windows does preserve the date times. – netadictos Oct 21 '10 at 11:14
You could read in the pictures byte by byte and compare them. If they don't match stop reading.
Something like this. It's pretty vague but you'll get the idea.
while (match && !end)
{
b1 = getnexctbytefromfilefirstfile();
b2 = getnextbytefromfilesecondfile();
if(b1 != b2)
{
match = false;
}
if(b1 == null || b2 == null)
{
end = true;
}
}

- 24,778
- 15
- 68
- 99