/// <summary> /// Update parameters of existing PSD image. Image data is passed in a request stream. /// </summary> public void CreateModifiedPsdFromRequestBody() { Console.WriteLine("Update parameters of a PSD image from request body"); using (var inputImageStream = File.OpenRead(Path.Combine(ExampleImagesFolder, SampleImageFileName))) { int? channelsCount = 3; var compressionMethod = "raw"; bool? fromScratch = null; 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 modifiedPsdRequest = new CreateModifiedPsdRequest(inputImageStream, channelsCount, compressionMethod, fromScratch, outPath, storage); Console.WriteLine( $"Call CreateModifiedPsd with params: channels count:{channelsCount}, compression method:{compressionMethod}"); using (var updatedImage = ImagingApi.CreateModifiedPsd(modifiedPsdRequest)) { SaveUpdatedSampleImageToOutput(updatedImage, true); } } Console.WriteLine(); }
public void CreateModifiedPsdTest(bool saveResultToStorage) { string name = "test.psd"; int channelsCount = 3; string compressionMethod = "raw"; bool? fromScratch = null; string outName = $"{name}_specific.psd"; string folder = TempFolder; string storage = this.TestStorage; this.TestPostRequest( "CreateModifiedPsdTest", saveResultToStorage, $"Input image: {name}; Channel count: {channelsCount}; Compression method: {compressionMethod}", name, outName, delegate(Stream inputStream, string outPath) { var request = new CreateModifiedPsdRequest(inputStream, channelsCount, compressionMethod, fromScratch, outPath, storage); return(ImagingApi.CreateModifiedPsd(request)); }, delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream) { Assert.NotNull(resultProperties.PsdProperties); Assert.AreEqual(compressionMethod, resultProperties.PsdProperties.Compression.ToLower()); Assert.AreEqual(channelsCount, resultProperties.PsdProperties.ChannelsCount); Assert.NotNull(originalProperties.PsdProperties); Assert.AreEqual(originalProperties.Width, resultProperties.Width); Assert.AreEqual(originalProperties.Height, resultProperties.Height); Assert.AreEqual(originalProperties.PsdProperties.BitsPerChannel, resultProperties.PsdProperties.BitsPerChannel); }, folder, storage); }