/// <summary> /// Rotate and/or flip an image, and upload updated image to Cloud Storage /// </summary> public void RotateFlipImageAndUploadToStorage() { Console.WriteLine("Rotate/flip an image and upload to cloud storage"); UploadSampleImageToCloud(); // Please refer to https://docs.aspose.cloud/display/imagingcloud/Supported+File+Formats#SupportedFileFormats-RotateFlip // for possible output formats var format = "gif"; var method = "Rotate90FlipX"; // RotateFlip method var folder = CloudPath; // Input file is saved at the Examples folder in the storage string storage = null; // We are using default Cloud Storage var getImageRotateFlipRequest = new RotateFlipImageRequest( SampleImageFileName, method, format, folder, storage); Console.WriteLine($"Call RotateFlipImage with params: method:{method}, format:{format}"); using (var updatedImage = ImagingApi.RotateFlipImage(getImageRotateFlipRequest)) { UploadImageToCloud(GetModifiedSampleImageFileName(false, format), updatedImage); } Console.WriteLine(); }
public void RotateFlipImageTest(string formatExtension, params string[] additionalExportFormats) { string name = null; string method = "Rotate90FlipX"; string folder = TempFolder; string storage = this.TestStorage; List <string> formatsToExport = new List <string>(this.BasicExportFormats); foreach (string additionalExportFormat in additionalExportFormats) { if (!formatsToExport.Contains(additionalExportFormat)) { formatsToExport.Add(additionalExportFormat); } } foreach (StorageFile inputFile in BasicInputTestFiles) { if (inputFile.Name.EndsWith(formatExtension)) { name = inputFile.Name; } else { continue; } foreach (string format in formatsToExport) { this.TestGetRequest( "RotateFlipImageTest", $"Input image: {name}; Output format: {format ?? "null"}; Method: {method}", name, delegate { var request = new RotateFlipImageRequest(name, method, format, folder, storage); return(ImagingApi.RotateFlipImage(request)); }, delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream) { try { Assert.AreEqual(originalProperties.Height, resultProperties.Width); } catch (Exception) { Assert.AreEqual(originalProperties.Height - 1, resultProperties.Width); } try { Assert.AreEqual(originalProperties.Width, resultProperties.Height); } catch (Exception) { Assert.AreEqual(originalProperties.Width - 1, resultProperties.Height); } }, folder, storage); } } }