How to transfer directly to WpfImageViewer

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
xgecko
Posts: 4
Joined: Mon Sep 09, 2019 11:42 pm

How to transfer directly to WpfImageViewer

Post by xgecko »

Hello,

I want to transfer the raw scan bitmap to the WpfImageViewer control. The only way I have found is to save the AcquiredImage to a file and then load from the file, but this is a real kludge. Is there a means by which I can directly transfer the image to the WpfImageViewer control?

Please advise.
Alex
Site Admin
Posts: 1942
Joined: Thu Jul 10, 2008 2:21 pm

Re: How to transfer directly to WpfImageViewer

Post by Alex »

Hello,

You can get scanned image as System.Drawing.Bitmap object, create Vintasoft.Imaging.VintasoftImage object from System.Drawing.Bitmap object and pass Vintasoft.Imaging.VintasoftImage object to the WpfImageViewe control. Please see code sample in our WPF Imaging Demo.

Best regards, Alexander
xgecko
Posts: 4
Joined: Mon Sep 09, 2019 11:42 pm

Re: How to transfer directly to WpfImageViewer

Post by xgecko »

I am working with the WPF library... so I do not think what you said applies to my project. I also found that I cannot instantiate a BitMapSource object for some reason, all I can do is a System.Windows.Media.Imaging.BitMapImage object which is derived from the BitMapImageSource.

And the WPFImageViewer does not seem to accept a BitMapImage.

So how do I directly transfer an image from the TWAIN object to the ImageViewer object in the WPF library?
Alex
Site Admin
Posts: 1942
Joined: Thu Jul 10, 2008 2:21 pm

Re: How to transfer directly to WpfImageViewer

Post by Alex »

Hello,

The Vintasoft.Imaging.Wpf.VintasoftImageConverter.FromBitmapSource method (https://www.vintasoft.com/docs/vsimagin ... ource.html) allows to convert the System.Windows.Media.Imaging.BitmapSource object (System.Windows.Media.Imaging.BitmapImage) to the Vintasoft.Imaging.VintasoftImage object.
Please use this method and let me know if you will have any question or problem.

Best regards, Alexander
Post Reply