JPG 文件是否有一些独特之处,以便我可以考虑重复项

发布于 2024-09-28 14:25:36 字数 125 浏览 1 评论 0原文

我想制作示例 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

∞觅青森が 2024-10-05 14:25:36

可以说 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.

偏爱你一生 2024-10-05 14:25:36

为什么不使用文件的校验和?为您扫描过的所有文件创建一个哈希表,并以校验和为键

Why not use the checksum for the file? create a hashtable for all the files you have scanned with the checksum as the key

ぽ尐不点ル 2024-10-05 14:25:36

我只会比较属性,如果它们全部匹配,则对内容进行散列并比较。

I would just compare the properties and if they all match then hash the contents and compare.

橘虞初梦 2024-10-05 14:25:36

您可以逐字节读取图片并进行比较。如果它们不匹配,请停止阅读。

像这样的东西。这是相当模糊的,但你会明白的。

while (match && !end)
{
    b1 = getnexctbytefromfilefirstfile();
    b2 = getnextbytefromfilesecondfile();

    if(b1 != b2)
    {
        match = false;
    }

    if(b1 == null || b2 == null)
    {
        end = true;
    }
}

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;
    }
}
依 靠 2024-10-05 14:25:36

如果您想走哈希路线,请查看此问题

If you want to go the hashing route, take a look at this question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文