Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Passing an image to a BitmapViewer control from scanner?
Rank: Member
Groups: Guest
Joined: 4/15/2007(UTC) Posts: 25
|
Dear sirs, we use a twain control in order to scan images. After we scan the image, we can pass System.Drawing.Bitmap object into the default .net studio PictureBox control and the image appears normally, using script : PictureBox1.Image = scanned bitmap object What we want to do is to make the same for a BitmapViewer (GM4 control), but until now we only know how to load from a file using BitmapViewer1.Bitmap.Load("c:\mypic.jpg") Any idea on how to load scanned System.Drawing.Bitmap object into GM4 BitmapViewer control? firamax
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hello, Yes, of course. Graphics Mill for .NET was specially designed to provide transparent interoperability with System.Drawing subsystem, so you should just simply cast System.Drawing.Bitmap object to the Aurigma.GraphicsMill.Bitmap: //C# syntax Code:System.Drawing.Bitmap sysBitmap = new System.Drawing.Bitmap(@"X:\FromWebDepartment\Samples\1.jpg");
Aurigma.GraphicsMill.Bitmap auBitmap = (Aurigma.GraphicsMill.Bitmap)sysBitmap;
auBitmap.Save(@"y:/1.png");
//Or
_bitmapViewerInstance.Bitmap = (Aurigma.GraphicsMill.Bitmap)sysBitmap;
'VB.NET syntax Code:Dim sysBitmap As New System.Drawing.Bitmap("X:\FromWebDepartment\Samples\1.jpg")
Dim auBitmap As Aurigma.GraphicsMill.Bitmap = Aurigma.GraphicsMill.Bitmap.op_Implicit(sysBitmap)
auBitmap.Save("y:\1.png")
'Or
_bitmapViewerInstance.Bitmap = Aurigma.GraphicsMill.Bitmap.op_Implicit(sysBitmap)
Please, take into account that this type cast performes copy of pixel data from System.Drawing.Bitmap instance to Aurigma.GraphicsMill.Bitmap one. Improper usage of such conversions may cause significant perfomance loss along with increased memory consuming. I recommend you to work mainly with objects of one type (Aurigma.GraphicsMill.Bitmaps or System.Drawing.Bitmaps) and to perform conversion only when it is really necessary. E.g. in your case you may obtain System.Drawing.Bitmap object from TWAIN control, convert it and use converted Aurigma.GraphicsMill.Bitmap in further operations. Edited by user Tuesday, December 18, 2007 3:26:06 AM(UTC)
| Reason: Not specified |
|
|
|
|
Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Passing an image to a BitmapViewer control from scanner?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.