Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I save the picture on image control in wpf?

I have a simple wpf application WIA.My app has an image control... I was wondering how can I save the scanned picture on my hard disk?

like image 389
M.Azad Avatar asked Dec 16 '22 14:12

M.Azad


1 Answers

Depends on the type of the Image.Source, assuming that you have a BitmapSource as in the article it should be along those lines:

var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create((BitmapSource)image.Source));
using (FileStream stream = new FileStream(filePath, FileMode.Create))
    encoder.Save(stream);
like image 144
H.B. Avatar answered Jan 05 '23 00:01

H.B.