/// <summary> /// Update parameters of existing GIF image. The image is saved in the cloud. /// </summary> public void ModifyGifAndUploadToStorage() { Console.WriteLine("Update parameters of a GIF image and upload to cloud storage"); UploadSampleImageToCloud(); int? backgroundColorIndex = 5; int? colorResolution = 4; bool? hasTrailer = true; bool? interlaced = false; bool? isPaletteSorted = true; int? pixelAspectRatio = 4; 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 getImageGifRequest = new ModifyGifRequest(SampleImageFileName, backgroundColorIndex, colorResolution, hasTrailer, interlaced, isPaletteSorted, pixelAspectRatio, fromScratch, folder, storage); Console.WriteLine( $"Call ModifyGif with params: background color index:{backgroundColorIndex}, color resolution:{colorResolution}, has trailer:{hasTrailer}, interlaced:{interlaced}, is palette sorted:{isPaletteSorted}, pixel aspect ratio:{pixelAspectRatio}"); using (var updatedImage = ImagingApi.ModifyGif(getImageGifRequest)) { UploadImageToCloud(GetModifiedSampleImageFileName(), updatedImage); } Console.WriteLine(); }
public void ModifyGifTest() { string name = "test.gif"; int? backgroundColorIndex = 5; int? colorResolution = 4; bool hasTrailer = true; bool interlaced = false; bool isPaletteSorted = true; int pixelAspectRatio = 4; bool? fromScratch = null; string folder = TempFolder; string storage = this.TestStorage; this.TestGetRequest( "ModifyGifTest", $"Input image: {name}; Back color index: {backgroundColorIndex}; Color resolution: {colorResolution}; Has trailer: {hasTrailer}; " + $"Interlaced: {interlaced}; Is palette sorted: {isPaletteSorted}; Pixel aspect ratio: {pixelAspectRatio}", name, delegate { var request = new ModifyGifRequest(name, backgroundColorIndex, colorResolution, hasTrailer, interlaced, isPaletteSorted, pixelAspectRatio, fromScratch, folder, storage); return(ImagingApi.ModifyGif(request)); }, delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream) { Assert.IsNotNull(resultProperties.GifProperties); // TODO: enable when IMAGINGCLOUD-51 is done //Assert.AreEqual(hasTrailer, resultProperties.GifProperties.HasTrailer); Assert.AreEqual(pixelAspectRatio, resultProperties.GifProperties.PixelAspectRatio); Assert.IsNotNull(originalProperties.GifProperties); Assert.AreEqual(originalProperties.Width, resultProperties.Width); Assert.AreEqual(originalProperties.Height, resultProperties.Height); }, folder, storage); }