Hi,
I figured out a strange scenario, that is rotation command on different IRasterImages will produce different rotation speed. I tried rotations on IRasterImage loaded by RasterCodes.Load() and IRasterImage returned by acquire() method (without file save). I found that the speed of rotation 90 degrees on image is much higher than the one in rotation on image loaded by RasterCodes.Load().
Time measurement:
Case (1) : rotations on IRasterImage loaded by RasterCodes.Load(), a TIF with file size 40KB
Output of my program :
Image size : 171356
It is compressed!
Rotate image 0 : 1156.25
Rotate image 1 : 796.875
Rotate image 2 : 796.875
Rotate image 3 : 812.5
Rotate image 4 : 781.25
Rotate image 5 : 843.75
Rotate image 6 : 796.875
Rotate image 7 : 796.875
Rotate image 8 : 796.875
Rotate image 9 : 781.25
Load Test 90 deg : : 8359.375
Time taken was measured in milliseconds.
Caes (2) : rotations IRasterImage returned by acquire() method
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 31.25
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 15.625
A4 ROTATE90 0
A4 ROTATE90 15.625
A4 ROTATE90 0
A4 ROTATE90 15.625
A4 ROTATE90 0
Most of the rotation opertions were completed in 16 milliseconds, even some of them took 0 (I don't understand this, can leadtools support kindly explain?)
Does anyone help to explain this scenario? This can kindly help us to improve the efficency of our
program.
The case 1 coding is listed as follow:
RasterCodecs rasterCodecs = new RasterCodecs();
rasterCodecs.Options.Load.Compressed = true;
IRasterImage image = rasterCodecs.Load(@"C:\tmp\images\output1.tif");
Console.Out.WriteLine("Image size : {0}", image.DataSize);
if ( image.IsCompressed )
Console.Out.WriteLine("It is compressed!");
else
Console.Out.WriteLine("It is non-compressed!");
RotateCommand rotate_cmd = new RotateCommand();
rotate_cmd.Angle = 90;
rotate_cmd.Flags = RotateCommandFlags.None;
DateTime startTime = DateTime.Now;
for ( int i = 0; i < 10; i++ )
{
DateTime time1 = DateTime.Now;
rotate_cmd.Run(image);
BenchMark("Rotate image " + i, time1);
}
startTime = BenchMark("Load Test 90 deg : ", startTime);
Thanks for your kind attention,
Raymond