Leadtools.Services.Raster.ServiceContracts Namespace > IRasterService Interface > Convert Method : Convert(String,String,String,RasterImageFormat,Int32,Int32,Int32,String,Int32) Method |
[OperationContractAttribute(Name="ConvertImage", Action="ConvertImage")] [FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=false)] [WebGetAttribute()] Stream Convert( string uri, string username, string password, RasterImageFormat format, int bitsPerPixel, int width, int height, string backColor, int qualityFactor )
'Declaration <OperationContractAttribute(Name="ConvertImage", Action="ConvertImage")> <FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=False)> <WebGetAttribute()> Overloads Function Convert( _ ByVal uri As String, _ ByVal username As String, _ ByVal password As String, _ ByVal format As RasterImageFormat, _ ByVal bitsPerPixel As Integer, _ ByVal width As Integer, _ ByVal height As Integer, _ ByVal backColor As String, _ ByVal qualityFactor As Integer _ ) As Stream
'Usage Dim instance As IRasterService Dim uri As String Dim username As String Dim password As String Dim format As RasterImageFormat Dim bitsPerPixel As Integer Dim width As Integer Dim height As Integer Dim backColor As String Dim qualityFactor As Integer Dim value As Stream value = instance.Convert(uri, username, password, format, bitsPerPixel, width, height, backColor, qualityFactor)
[OperationContractAttribute(Name="ConvertImage", Action="ConvertImage")] [FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=false)] [WebGetAttribute()] Stream Convert( string uri, string username, string password, RasterImageFormat format, int bitsPerPixel, int width, int height, string backColor, int qualityFactor )
OperationContractAttribute(Name="ConvertImage", Action="ConvertImage") FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=) WebGetAttribute() function Leadtools.Services.Raster.ServiceContracts.IRasterService.Convert(String,String,String,RasterImageFormat,Int32,Int32,Int32,String,Int32)( uri , username , password , format , bitsPerPixel , width , height , backColor , qualityFactor )
[OperationContractAttribute(Name="ConvertImage", Action="ConvertImage")] [FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=false)] [WebGetAttribute()] Stream^ Convert( String^ uri, String^ username, String^ password, RasterImageFormat format, int bitsPerPixel, int width, int height, String^ backColor, int qualityFactor )
Public Sub ConvertImageExample() Dim buffer As Byte() = New Byte(1024 * 64 - 1) {} Dim totalBytesRead As Integer = 0 Dim memoryStream As MemoryStream = New MemoryStream() Dim client As RasterServiceClient = New RasterServiceClient() Dim stream As Stream = client.ConvertImage("http://sp2007ep/Ocr/Shared%20Documents/OCR.TIF", "username", "password", RasterImageFormat.Bmp, 24, 200, 200, "White", 0) Dim bytesRead As Integer 'TODO: INSTANT VB TODO TASK: Assignments within expressions are not supported in VB.NET 'ORIGINAL LINE: while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0) Do While (bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0 totalBytesRead += bytesRead memoryStream.Write(buffer, 0, bytesRead) Loop File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "convertimage.bmp"), memoryStream.ToArray()) client.Close() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void ConvertImageExample() { byte[] buffer = new byte[1024 * 64]; int totalBytesRead = 0; MemoryStream memoryStream = new MemoryStream(); RasterServiceClient client = new RasterServiceClient(); Stream stream = client.ConvertImage(@"http://sp2007ep/Ocr/Shared%20Documents/OCR.TIF", "username", "password", RasterImageFormat.Bmp, 24, 200, 200, "White", 0); int bytesRead; while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0) { totalBytesRead += bytesRead; memoryStream.Write(buffer, 0, bytesRead); } File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir,"convertimage.bmp"), memoryStream.ToArray()); client.Close(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2