473,388 Members | 1,499 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

C#-FORM : Using GetHashCode() to compare files.

1
I am trying to read a large number of image (BMP, JPG) files, and need to know if any are identical. I have been trying to store the hashcodes of the files, so that they then can be compared later.

But this function...

Expand|Select|Wrap|Line Numbers
  1.         private void imageHash(string filename)
  2.         {
  3.             FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None);
  4.             Image image = Image.FromStream(fs);
  5.             Int32 imagehash = image.GetHashCode();            
  6.             MessageBox.Show(imagehash.ToString());            
  7.             fs.Close();
  8.             fs.Dispose();            
  9.         }
  10.  
...seems to return different values when the same filename is supplied.

What am I doing wrong?
Jan 20 '08 #1
0 1637

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: could ildg | last post by:
I want to compare 2 directories, and find If all of theire sub-folders and files and sub-files are identical.. If not the same, I want know which files or folders are not the same. I know filecmp...
1
by: jyoti | last post by:
I am new in asp. I have two html files. I like to write code to compare those two files. I like to show the difference as highlighted area. Example: File 1 contains: <html><body> Compare...
5
by: PyPK | last post by:
I have two files file1 in format <id> <val1> <test1> <test2> 'AA' 1 T T 'AB' 1 T F file2 same as file1 <id> <val1> <test1> <test2> 'AA' 1 T T 'AB' 1 T T
8
by: Vincent | last post by:
has any one seen a program to compare mdbs'. I have ran into a few of them, but none seem to really do that job. Basically what I need to do is, take 2 access mdb's and check the differences...
2
by: SP | last post by:
Hi All, I need to compare two files line by line and copy the differing lines to a new files. I.e. Compare file1 and file2 line by line. Copy only differing lines to file3. I tried a couple...
2
by: yinglcs | last post by:
I am new to python. How can I compare if 2 files has duplicate entries in python? Is there an example for that? What if the files are big and I don't want to read the whole file in memory. ...
2
by: Nitro | last post by:
Does anyone know a simple way to compare two images to see if they are the same? The filenames of the images will be different, but if the image data is the same I would like to test for that. ...
6
by: yinglcs | last post by:
Hi, i have 2 files which are different (1 line difference): $ diff groupresult20070226190027.xml groupresult20070226190027-2.xml 5c5 < x:22 y:516 w:740 h:120 area: --- But when I use the...
1
by: =?Utf-8?B?RGFuaWVsIERpIFZpdGE=?= | last post by:
II want to compare how many seconds there are between files. If the files are within a 1 - 10 second range I want to copy them to their own folders. What I have so far is a couple methods that take...
4
by: Clay Hobbs | last post by:
I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.