JPG 文件是否有一些独特之处,以便我可以考虑重复项
我想制作示例 WinForm C# 应用程序,用于在我的笔记本电脑上查找重复的照片。
我的问题是是否有一些记录、标签、Exif 数据或其他 JPG(照片)文件所特有的内容。
所以我可以读取放入数据集中的数据并寻找重复项。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
可以说 Exif 数据是独一无二的。下表为您提供了从 Exif 数据中获取信息的良好简历:
http://en.wikipedia.org/wiki/Exchangeable_image_file_format#Example
看看这个项目,请确保代码会对您有所帮助:
http://jpegdata.codeplex.com/
在此 stackoveflow问题,获取Exif数据有一个很好的答案:
“如果您针对框架 v3(或更高版本)进行编译,则可以使用 BitmapSource 类加载图像,该类通过 Metadata 属性公开 EXIF 元数据”
不过,我会比较名称和日期,并且它必须足够了。
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:
http://jpegdata.codeplex.com/
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.
为什么不使用文件的校验和?为您扫描过的所有文件创建一个哈希表,并以校验和为键
Why not use the checksum for the file? create a hashtable for all the files you have scanned with the checksum as the key
我只会比较属性,如果它们全部匹配,则对内容进行散列并比较。
I would just compare the properties and if they all match then hash the contents and compare.
您可以逐字节读取图片并进行比较。如果它们不匹配,请停止阅读。
像这样的东西。这是相当模糊的,但你会明白的。
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.
如果您想走哈希路线,请查看此问题。
If you want to go the hashing route, take a look at this question.