//cropped -тут приходит обрезанное изображение
var cropped = CropImage(scr, new Rectangle(436, 986, 23, 26));
string ss = "";
if (cropped != null)
{
int width = cropped.Width;
int height = cropped.Height;
decimal aspectRatio = width > height ? decimal.Divide(width, height) : decimal.Divide(height, width);
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
cropped.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
Byte[] imageBytes = stream.GetBuffer();
System.Security.Cryptography.MD5CryptoServiceProvider provider = new System.Security.Cryptography.MD5CryptoServiceProvider();
Byte[] hash = provider.ComputeHash(imageBytes);
System.Text.StringBuilder hashBuilder = new System.Text.StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
hashBuilder.Append(hash[i].ToString("X2"));
}
ss = hashBuilder.ToString();
stream.Dispose();
}
cropped.Dispose();