判断两张图片不是同一张

lanwen0180k 2014-08-21 09:35:08
bat或vbs 除了可以通过两张图片的字节判断图片不是同一张,还有什么方法
求代码!
...全文
1101 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
用Bitmap.GetPixel获取像素颜色,两张图进行对比,全部相同代表相同
w12wangbo 2014-08-25
  • 打赏
  • 举报
回复
获取文件的md5值 vb.net 源代码 Public Function GetFileMD5(ByVal FilePath As String) As String '获取文件的MD5值,文件越大,耗时越长。 Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider Dim fs As FileStream = New FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read, 8192) md5.ComputeHash(fs) '就是把文件转化为二进制字节数组,hash一下即可。 fs.Close() Dim s As String Dim hash As Byte() = md5.Hash Dim sb As StringBuilder = New StringBuilder For Each hBym In hash s = Hex(hBym) If s.Length = 1 Then s = "0" & s '补成两位十六进制数 sb.Append(s) '把每个字节准换为两个十六进制数 Next Return sb.ToString End Function '获取文件的MD5值,文件越大,耗时越长。
threenewbee 2014-08-22
  • 打赏
  • 举报
回复
使用fc命令

FC

Compares two files and displays the differences between them.

Syntax

fc [/a] [/b] [/c] [/l] [/lbn] [/n] [/t] [/u] [/w] [/nnnn] [drive1:][path1]filename1 [drive2:][path2]filename2
Parameters

/a : Abbreviates the output of an ASCII comparison. Instead of displaying all of the lines that are different, fc displays only the first and last line for each set of differences.

/b : Compares the files in binary mode. Fc compares the two files byte by byte and does not attempt to resynchronize the files after finding a mismatch. This is the default mode for comparing files that have the following file extensions: .exe, .com, .sys, .obj, .lib, or .bin.

/c : Ignores the case of letters.

/l : Compares the files in ASCII mode. Fc compares the two files line by line and attempts to resynchronize the files after finding a mismatch. This is the default mode for comparing files, except files with the following file extensions: .exe, .com, .sys, .obj, .lib, or .bin.

/lbn : Sets the n number of lines for the internal line buffer. The default length of the line buffer is 100 lines. If the files that you are comparing have more than this number of consecutive differing lines, fc cancels the comparison.

/n : Displays the line numbers during an ASCII comparison.

/t : Prevents fc from converting tabs to spaces. The default behavior is to treat tabs as spaces, with stops at each eighth character position.

/u : Compares files as Unicode text files.

/w : Compresses white space (that is, tabs and spaces) during the comparison. If a line contains many consecutive spaces or tabs, /w treats these characters as a single space. When used with the /w command-line option, fc ignores (and does not compare) white space at the beginning and end of a line.

/nnnn : Specifies the number of consecutive lines that must match before fc considers the files to be resynchronized. If the number of matching lines in the files is less than nnnn, fc displays the matching lines as differences. The default value is 2.

[drive1:][path1]filename1 : Specifies the location and name of the first file you want to compare. Filename1 is required.

[drive2:][path2]filename2 : Specifies the location and name of the second file you want to compare. Filename2 is required.

/? : Displays help at the command prompt.

http://stackoverflow.com/questions/21205214/to-check-if-two-txt-files-have-same-content-using-batch-file
by_封爱 2014-08-22
  • 打赏
  • 举报
回复
无解...不管你用什么 你都判断不出来...比如一个图片100*100 另外一个1000*1000 请问你说这是一张图片吗? 一个图片 我复制粘贴出来一份 你说 他俩是一张吗?
freecodex 2014-08-22
  • 打赏
  • 举报
回复
WM_JAWIN 2014-08-22
  • 打赏
  • 举报
回复
VBS 或BAT的话估计只能对文件大小进行判断了。
lanwen0180k 2014-08-22
  • 打赏
  • 举报
回复
引用 1 楼 w12wangbo 的回复:
获取文件的md5值 比较一下就知道了 给分吧 呵呵
求下 bat或 vbs 获取文件md5的代码 网上找了半天找不到! 谢谢
lanwen0180k 2014-08-22
  • 打赏
  • 举报
回复
引用 2 楼 sp1234 的回复:
先要让人说明白如何判断?! 文件少几个字节,怎么就敢说不是同一个图片?
简单说,就是两张什么东西都完全一样,就是同一张 有任何区别就都不是同一张了
lanwen0180k 2014-08-22
  • 打赏
  • 举报
回复
引用 6 楼 diaodiaop 的回复:
无解...不管你用什么 你都判断不出来...比如一个图片100*100 另外一个1000*1000 请问你说这是一张图片吗? 一个图片 我复制粘贴出来一份 你说 他俩是一张吗?
大小都不同了,还能叫同一张图片吗?
  • 打赏
  • 举报
回复
先要让人说明白如何判断?! 文件少几个字节,怎么就敢说不是同一个图片?
w12wangbo 2014-08-21
  • 打赏
  • 举报
回复
获取文件的md5值 比较一下就知道了 给分吧 呵呵

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧