Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

Have img from memorystream

$
0
0
Hello all!

Once again I'm here to ask a dumb and simple question that is really bugging me.

I have this code to download the image, take its hash and save it. If I hash the image while it's in the memorystream it matches 100% to the image if I manually downloaded it.
Now once I save the image and hash that, it gives me something else, even though the image looks the same.

Here is the code:

vb.net Code:
  1. Dim tClient As WebClient = New WebClient
  2.         Dim captcha As MemoryStream = New MemoryStream(tClient.DownloadData(myUrlToCaptcha))
  3.  
  4.         'This will give me an exact hash of the image
  5.         Label2.Text = "Hash: " + GetMD5(captcha)
  6.        
  7.  
  8.         'This is the problem I think. The Original image is .jpg
  9.         Dim returnImage As Image = Image.FromStream(captcha)
  10.         returnImage.Save("C:\aa.jpg", ImageFormat.Jpeg)
  11.  
  12.  
  13.         'If I hash the new image, it will give me something else

Now I'm no expert in imaging but I know that .jpg is not the same as .jpeg. Could this issue be that I'm telling its ImageFormat.jpeg? Or is it something else?

Thanks !

Viewing all articles
Browse latest Browse all 42220

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>