मैं वर्तमान में एक ऐसी प्रणाली लिख रहा हूं जो क्लाउड स्टोरेज में स्थानांतरित होने वाली विरासत छवि लाइब्रेरी में संग्रहीत लगभग 140,000 आईएसएच छवियों के लिए मेटा डेटा संग्रहीत करता है। मैं जेपीजी डेटा"System.Drawing.Image" का फ़ाइल आकार कैसे प्राप्त करें
System.Drawing.Image image = System.Drawing.Image.FromFile("filePath");
इम काफी छवि हेरफेर करने के लिए नए प्राप्त करने के लिए ... निम्नलिखित का उपयोग कर रहा है, लेकिन इस चौड़ाई, ऊंचाई, पहलू अनुपात आदि लेकिन क्या मैं बाहर काम नहीं कर सकता है कि कैसे है की तरह साधारण मूल्यों प्राप्त करने के लिए ठीक है बाइट्स में व्यक्त jpg के भौतिक फ़ाइल आकार को पुनर्प्राप्त करने के लिए। कोई भी सहायताकाफी प्रशंसनीय होगी।
धन्यवाद
बाद में तुलना
System.Drawing.Image image = System.Drawing.Image.FromFile(filePath);
if (image != null)
{
int width = image.Width;
int height = image.Height;
decimal aspectRatio = width > height ? decimal.divide(width, height) : decimal.divide(height, width);
int fileSize = (int)new System.IO.FileInfo(filePath).Length;
using (System.IO.MemoryStream stream = new System.IO.MemoryStream(fileSize))
{
image.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"));
}
string md5 = hashBuilder.ToString();
}
image.Dispose();
}