private Bitmap GetBitMapFromFile( string imageFileName )
{
byte[] buffer = null;
Stream stream = null;
try
{
stream = new FileStream(
imageFileName, // String Path
FileMode.Open , // FileMode
FileAccess.Read , // FileAccess
FileShare.Read , // FileShare
4096 , // bufferSize
true ); // useAsync
buffer = new byte[stream.Length];
stream.Seek(0,SeekOrigin.Begin);
stream.Read(buffer,0,(int)stream.Length);
}
catch( )// make simple for posting
{
}
finally
{
if( stream != null )
{
stream.Close();
}
}
// Memory Retention
// The new MemoryStream cause memory retention
return Bitmap.FromStream(new MemoryStream(buffer)) as Bitmap;
}