convert image to bitmap image
i want to convert image to bitmapimage .
i pass imagesource parameter to below method
imagesource="example.jpg";
but at imagesource.streamsource i getting null value
plz tell me how to convert image to bitmap image
public Byte[] BufferFromImage(BitmapImage imageSource)
{
Stream stream = imageSource.StreamSource;
Byte[] buffer = null;
if (stream != null && stream.Length > 0)
{
using (BinaryReader br = new BinaryReader(stream))
{
buffer = br.ReadBytes((Int32)stream.Length);
}
}
return buffer;