Creates a new Leadtools.RasterImage from the specified existing GDI+ System.Drawing.Image object.
public static Leadtools.RasterImage ConvertFromImage(Image image,Leadtools.Drawing.ConvertFromImageOptions options)
Public Shared Function ConvertFromImage( _ByVal image As Image, _ByVal options As Leadtools.Drawing.ConvertFromImageOptions _) As Leadtools.RasterImage
public:static Leadtools.RasterImage^ ConvertFromImage(Image^ image,Leadtools.Drawing.ConvertFromImageOptions options)
image
The System.Drawing.Image from which to create the new Leadtools.RasterImage.
options
The conversion options.
To convert a LEADTOOLS Leadtools.RasterImage to GDI+ image, use ConvertToImage.
For more information refer to RasterImage and GDI/GDI+.
This example converts between a Leadtools.RasterImage and a GDI+ image.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.DrawingImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.Color<TestMethod()> _Public Sub ConvertFromImageExample()Dim codecs As New RasterCodecs()Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "ConvertFromImage.bmp")' Create a GDI+ imageUsing btmp As Bitmap = New Bitmap(320, 200)Using g As Graphics = Graphics.FromImage(btmp)g.Clear(Color.Yellow)g.FillEllipse(Brushes.Red, New Rectangle(0, 0, btmp.Width, btmp.Height))' Convert this image to RasterImageUsing image As RasterImage = RasterImageConverter.ConvertFromImage(btmp, ConvertFromImageOptions.None)' Save itcodecs.Save(image, destFileName, RasterImageFormat.Bmp, 0)End UsingEnd UsingEnd Using' Clean upcodecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Drawing;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;public void ConvertFromImageExample(){RasterCodecs codecs = new RasterCodecs();string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "ConvertFromImage.bmp");// Create a GDI+ imageusing(Bitmap btmp = new Bitmap(320, 200)){using(Graphics g = Graphics.FromImage(btmp)){g.Clear(Color.Yellow);g.FillEllipse(Brushes.Red, new Rectangle(0, 0, btmp.Width, btmp.Height));// Convert this image to RasterImageusing(RasterImage image = RasterImageConverter.ConvertFromImage(btmp, ConvertFromImageOptions.None)){// Save itcodecs.Save(image, destFileName, RasterImageFormat.Bmp, 0);}}}// Clean upcodecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: ConvertFromImage Method - Leadtools.Drawing |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.