/// <summary>
        ///     Resize an image. Image data is passed in a request stream.
        /// </summary>
        public void CreateResizedImageFromRequestBody()
        {
            Console.WriteLine("Resize an image from request body");

            using (var inputImageStream = File.OpenRead(Path.Combine(ExampleImagesFolder, SampleImageFileName)))
            {
                // Please refer to https://docs.aspose.cloud/display/imagingcloud/Supported+File+Formats#SupportedFileFormats-Resize
                // for possible output formats
                var    format    = "gif";
                int?   newWidth  = 100;
                int?   newHeight = 150;
                string outPath   = null; // Path to updated file (if this is empty, response contains streamed image).
                string storage   = null; // We are using default Cloud Storage

                var createResizedImageRequest = new CreateResizedImageRequest(
                    inputImageStream, newWidth, newHeight, format, outPath, storage);

                Console.WriteLine(
                    $"Call CreateResizedImage with params: new width:{newWidth}, new height:{newHeight}, format:{format}");

                using (var updatedImage = ImagingApi.CreateResizedImage(createResizedImageRequest))
                {
                    // Save updated image to local storage
                    SaveUpdatedSampleImageToOutput(updatedImage, true, format);
                }
            }

            Console.WriteLine();
        }
        public void CreateResizedImageTest(string formatExtension, bool saveResultToStorage, params string[] additionalExportFormats)
        {
            string name      = null;
            int?   newWidth  = 100;
            int?   newHeight = 150;
            string folder    = TempFolder;
            string storage   = this.TestStorage;
            string outName   = null;

            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)
                {
                    outName = $"{name}_resize.{format ?? formatExtension.Substring(1)}";

                    this.TestPostRequest(
                        "CreateResizedImageTest",
                        saveResultToStorage,
                        $"Input image: {name}; Output format: {format ?? "null"}; New width: {newWidth}; New height: {newHeight}",
                        name,
                        outName,
                        delegate(Stream inputStream, string outPath)
                    {
                        var request = new CreateResizedImageRequest(inputStream, newWidth, newHeight, format, outPath, storage);
                        return(ImagingApi.CreateResizedImage(request));
                    },
                        delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream)
                    {
                        Assert.AreEqual(newWidth, resultProperties.Width);
                        Assert.AreEqual(newHeight, resultProperties.Height);
                    },
                        folder,
                        storage);
                }
            }
        }