Hello Daniel,
Your code looks correct, however the simultaneous image decoding (asynchronously in viewer) with encoding of the same image causes a mutual locking.
It isn't a good practice because, theoretically, there might take place any changes in image collection: removing images, insert etc. and this may cause a failure in decoding.
What is your task?
You can at first rotate the image, save changes and then open the file in viewer:
Code: Select all
ImageCollection images = new ImageCollection();
images.Add(@"c:\test\test.tif", false);
images[0].Rotate(90);
Vintasoft.Imaging.Codecs.Encoders.TiffEncoder teTest =
new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder();
teTest.SaveAndSwitchSource = true;
images.SaveSync(@"c:\test\test.tif", teTest);
this.imageViewer1.Images.AddRange(images.ToArray());
Or another way is to copy the file into memory:
Code: Select all
Vintasoft.Imaging.Codecs.Encoders.TiffEncoder teTest;
MemoryStream ms = new MemoryStream(File.ReadAllBytes(@"c:\test\test.tif"));
this.imageViewer1.Images.Add(ms, true);
this.imageViewer1.Images[0].Rotate(90);
teTest = new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder();
teTest.SaveAndSwitchSource = true;
this.imageViewer1.Images.SaveSync(@"c:\test\test.tif", teTest);
--
Kind regards, Yuri