Page 1 of 1

Casting Vintasoft Image to Image

Posted: Tue Aug 19, 2014 5:27 pm
by BillG
I have an app i am creating that allows the user to upload a picture to my application or take a picture using a webcam. I have a picturebox on a form where i place the image that was uploaded. Now i have the code written to capture the image using the webcam. The image is a VintasoftImage. Now i want to place the image in the same picturebox. Can i place a VintasoftImage in a windows picturebox or do i have to cast it first to an image. Then i am saving the image to a sql server database table.

Bill

Re: Casting Vintasoft Image to Image

Posted: Tue Aug 19, 2014 7:24 pm
by Alex
Hi Bill,

System.Windows.Forms.PictureBox control can display only System.Drawing.Image (System.Drawing.Bitmap) object. You can convert VintasoftImage object to a System.Drawing.Bitmap object using the VintasoftImage.GetAsBitmap() method.

VintaSoftImaging.NET SDK also have control for displaying images - Vintasoft.Imaging.UI.ImageViewer class.

Please read more info in on-line documentation of SDK: http://www.vintasoft.com/docs/vsimaging-dotnet/

Best regards, Alexander

Re: Casting Vintasoft Image to Image

Posted: Tue Aug 19, 2014 8:59 pm
by BillG
so you are saying replace the picture box with the image viewer and show both types in the image viewer the image i upload and the image captured from the webcam? How do i cast a regular image to a vintasoft image to put in the image viewer?

Bill

Re: Casting Vintasoft Image to Image

Posted: Wed Aug 20, 2014 8:28 am
by Alex
so you are saying replace the picture box with the image viewer and show both types in the image viewer the image i upload and the image captured from the webcam?
Yes, I think this is good way because Vintasoft.Imaging.UI.ImageViewer control has better functionality than System.Windows.Forms.PictureBox control.

How do i cast a regular image to a vintasoft image to put in the image viewer?
You can create VintasoftImage object which contains the Bitmap object using the following code:

Code: Select all

VintasoftImage image = Vintasoft.Imaging.VintasoftImageGdiExtensions.Create(bitmap, true);
Boolean parameter in constructor of VintasoftImage class determines that Bitmap must be disposed when the VintasoftImage is disposed. You can set boolean parameter to False if Bitmap should not be destroyed when VintasoftImage will be destroyed.

Best regards, Alexander