/// <summary> /// Converts an uploaded image in common formats such as JPEG, PNG into text /// via Optical Character Recognition. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='imageFile'> /// Image file to perform OCR on. Common file formats such as PNG, JPEG are /// supported. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <PostOKResponse> PostAsync(this IImageOcr operations, System.IO.Stream imageFile, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PostWithHttpMessagesAsync(imageFile, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Converts an uploaded image in common formats such as JPEG, PNG into text /// via Optical Character Recognition. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='imageFile'> /// Image file to perform OCR on. Common file formats such as PNG, JPEG are /// supported. /// </param> public static PostOKResponse Post(this IImageOcr operations, System.IO.Stream imageFile) { return(Task.Factory.StartNew(s => ((IImageOcr)s).PostAsync(imageFile), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }