public void ModifyWebPTest() { string name = "Animation.webp"; bool lossless = true; int quality = 90; int animLoopCount = 5; string animBackgroundColor = "gray"; bool? fromScratch = null; string folder = TempFolder; string storage = this.TestStorage; this.TestGetRequest( "ModifyWebPTest", $"Input image: {name}; AnimBackgroundColor: {animBackgroundColor}; Lossless: {lossless}; Quality: {quality}; AnimLoopCount: {animLoopCount}", name, delegate { var request = new ModifyWebPRequest(name, lossless, quality, animLoopCount, animBackgroundColor, fromScratch, folder, storage); return(ImagingApi.ModifyWebP(request)); }, delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream) { Assert.NotNull(resultProperties.WebPProperties); Assert.NotNull(originalProperties.WebPProperties); Assert.AreEqual(originalProperties.Width, resultProperties.Width); Assert.AreEqual(originalProperties.Height, resultProperties.Height); }, folder, storage); }
/// <summary> /// Update parameters of existing WEBP image, and upload updated image to Cloud Storage. /// </summary> public void ModifyWebPAndUploadToStorage() { Console.WriteLine("Update parameters of a WEBP image and upload to cloud storage"); UploadSampleImageToCloud(); bool?lossless = true; int? quality = 90; int? animLoopCount = 5; var animBackgroundColor = "gray"; // Specifies where additional parameters we do not support should be taken from. // If this is true – they will be taken from default values for standard image, // if it is false – they will be saved from current image. Default is false. bool? fromScratch = null; var folder = CloudPath; // Input file is saved at the Examples folder in the storage string storage = null; // We are using default Cloud Storage var getImageWebPRequest = new ModifyWebPRequest(SampleImageFileName, lossless, quality, animLoopCount, animBackgroundColor, fromScratch, folder, storage); Console.WriteLine( $"Call ModifyWebP with params: lossless:{lossless}, quality:{quality}, anim loop count:{animLoopCount}, anim background color:{animBackgroundColor}"); using (var updatedImage = ImagingApi.ModifyWebP(getImageWebPRequest)) { UploadImageToCloud(GetModifiedSampleImageFileName(), updatedImage); } Console.WriteLine(); }