how record distance "system.drawing.image"
i am now minute component stores meta information around 140,000 ish images stored within leave settlement library being changed cloud storage. i am controlling following jpg data...
system.drawing.image settlement = system.drawing.image.fromfile("filepath");
im definitely new settlement plan nonetheless glorious removing rudimentary values width, height, aspect ratio etc nonetheless i can't work out collect physical record distance jpg spoken bytes. any assistance many appreciated.
thanks
final fortitude including an md5 crush settlement after comparison
system.drawing.image settlement = system.drawing.image.fromfile(filepath);
if (image != null)
{
int extent = image.width;
int tallness = image.height;
decimal aspectratio = extent > tallness ? decimal.divide(width, height) : decimal.divide(height, width);
int filesize = (int)new system.io.fileinfo(filepath).length;
controlling (system.io.memorystream tide = 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[] crush = provider.computehash(imagebytes);
system.text.stringbuilder hashbuilder = new system.text.stringbuilder();
(int i = 0; i < hash.length; i++)
{
hashbuilder.append(hash[i].tostring("x2"));
}
twine md5 = hashbuilder.tostring();
}
image.dispose();
}
Comments
Post a Comment