/// <summary>
        ///     Update parameters of existing JPEG2000 image, and upload updated image to Cloud Storage.
        /// </summary>
        public void ModifyJpeg2000AndUploadToStorage()
        {
            Console.WriteLine("Update parameters of a Jpeg2000 image and upload to cloud storage");

            UploadSampleImageToCloud();

            var    codec       = "jp2";
            var    comment     = "Aspose";
            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 getImageJpeg2000Request =
                new ModifyJpeg2000Request(SampleImageFileName, comment, codec, fromScratch, folder, storage);

            Console.WriteLine($"Call ModifyJpeg2000 with params: codec:{codec}, comment:{comment}");

            using (var updatedImage = ImagingApi.ModifyJpeg2000(getImageJpeg2000Request))
            {
                UploadImageToCloud(GetModifiedSampleImageFileName(), updatedImage);
            }

            Console.WriteLine();
        }
예제 #2
0
        public void ModifyJpeg2000Test()
        {
            string name        = "test.j2k";
            string codec       = "jp2";
            string comment     = "Aspose";
            bool?  fromScratch = null;
            string folder      = TempFolder;
            string storage     = this.TestStorage;

            this.TestGetRequest(
                "ModifyJpeg2000Test",
                $"Input image: {name}; Comment: {comment}; Codec: {codec}",
                name,
                delegate
            {
                var request = new ModifyJpeg2000Request(name, comment, codec, fromScratch, folder, storage);
                return(ImagingApi.ModifyJpeg2000(request));
            },
                delegate(ImagingResponse originalProperties, ImagingResponse resultProperties, Stream resultStream)
            {
                Assert.IsNotNull(resultProperties.Jpeg2000Properties);

                Assert.IsNotNull(resultProperties.Jpeg2000Properties.Codec);
                Assert.AreEqual(codec, resultProperties.Jpeg2000Properties.Codec.ToString().ToLower());
                Assert.IsNotNull(resultProperties.Jpeg2000Properties.Comments);
                Assert.AreEqual(comment, resultProperties.Jpeg2000Properties.Comments[0]);

                Assert.IsNotNull(originalProperties.Jpeg2000Properties);
                Assert.AreEqual(originalProperties.Width, resultProperties.Width);
                Assert.AreEqual(originalProperties.Height, resultProperties.Height);
                Assert.IsNotNull(originalProperties.Jpeg2000Properties.Comments);
                Assert.AreNotEqual(comment, originalProperties.Jpeg2000Properties.Comments[0]);
            },
                folder,
                storage);
        }