/// <summary>
        /// Deskew an existing image, and upload updated image to a cloud storage.
        /// </summary>
        public void DeskewImageAndUploadToStorage()
        {
            Console.WriteLine("Deskews the image and upload to cloud storage");

            UploadSampleImageToCloud();

            bool   resizeProportionally = true;
            string bkColor = null;
            string folder  = CloudPath; // Input file is saved at the Examples folder in the storage
            string storage = null;      // We are using default Cloud Storage

            var request = new DeskewImageRequest(SampleImageFileName, resizeProportionally, bkColor, folder, storage);

            Console.WriteLine($"Call DeskewImage with params: resizeProportionally:{resizeProportionally}, bkColor:{bkColor}");

            using (Stream updatedImage = this.ImagingApi.DeskewImage(request))
            {
                UploadImageToCloud(GetModifiedSampleImageFileName(false, SaveImageFormat), updatedImage);
            }

            Console.WriteLine();
        }
예제 #2
0
 public void DeskewImageTest(string formatExtension, bool resizeProportionally, string bkColor = null)
 {
     foreach (StorageFile inputFile in BasicInputTestFiles.Where(f => f.Name.EndsWith("." + formatExtension)))
     {
         this.TestGetRequest(
             "DeskewImageTest",
             $"Input image: {inputFile.Name}; Output format: {formatExtension}; Resize proportionally: {resizeProportionally}; Background color: {bkColor ?? "null"};",
             inputFile.Name,
             delegate
         {
             var request = new DeskewImageRequest(inputFile.Name, resizeProportionally, bkColor, TempFolder,
                                                  TestStorage);
             return(ImagingApi.DeskewImage(request));
         },
             delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream)
         {
             Assert.NotNull(resultStream);
             Assert.IsTrue(resultStream.Length > 0);
             Assert.AreEqual(originalProperties.BitsPerPixel, resultProperties.BitsPerPixel);
         },
             TempFolder,
             TestStorage);
     }
 }