VintaSoft Imaging .NET SDK and Plug-ins Discussions

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

Board index < VintaSoft Imaging < VintaSoft Imaging .NET SDK and Plug-ins Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Casting Vintasoft Image to Image



Casting Vintasoft Image to Image

Post 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

Post 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: https://www.vintasoft.com/docs/vsimaging-dotnet/

Best regards, Alexander


Re: Casting Vintasoft Image to Image

Post 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

Post 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:
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


Page 1 from 1: 1