test
private void Test2()
{
try
{
DateTime dt1 = DateTime.Now;
ArrayList al = new ArrayList();
//al.Add(@"C:\test\mergeTif\1.tif");
//al.Add(@"C:\test\mergeTif\2.tif");
//al.Add(@"C:\test\mergeTif\4.tif");
//al.Add(@"C:\test\mergeTif\5.tif");
////al.Add(@"C:\test\mergeTif\3.tif");
////al.Add(@"C:\test\mergeTif\4.tif");
////al.Add(@"C:\test\mergeTif\5.tif");
//al.Add(@"C:\test\mergeTif\6.tif");
//al.Add(@"C:\test\mergeTif\7.tif");
//al.Add(@"C:\test\mergeTif\8.tif");
//al.Add(@"C:\test\mergeTif\9.tif");
//al.Add(@"C:\test\mergeTif\10.tif");
//al.Add(@"C:\test\mergeTif_18\2.tif");
//al.Add(@"C:\test\mergeTif_18\31.tif");
//al.Add(@"C:\test\mergeTif_18\44.tif");
//al.Add(@"C:\test\mergeTif_18\4.tif");
al.Add(@"C:\test\mergeTif_18\1.tif");
al.Add(@"C:\test\mergeTif_18\11.tif");
string outputFile = @"C:\test\mergeTif_18\mergedImage24.tif";
TiffUtity.JoinTiffImages(al, outputFile, EncoderValue.CompressionCCITT4);
DateTime dt2 = DateTime.Now;
TimeSpan ts = dt2 - dt1;
MessageBox.Show("cost toatl time is:" + ts.Seconds + " s and " + ts.Milliseconds + " ms");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
------------------------------------------
private void btnMergeWithBitMiracle_Click(object sender, EventArgs e)
{
try
{
DateTime dt1 = DateTime.Now;
//Bitmap bt1 = new Bitmap(@"C:\test\mergeTif\1.tiff");
//Bitmap bt2 = new Bitmap(@"C:\test\mergeTif\2.tiff");
//string[] bmps = new string[] { @"C:\test\mergeTif_18\2.tif", @"C:\test\mergeTif_18\4.tif", @"C:\test\mergeTif_18\310.tif" };
//string[] bmps = new string[] { @"C:\test\mergeTif_18\441.jpg", @"C:\test\mergeTif_18\311.jpg", @"C:\test\mergeTif_18\2.tif" };
//1: 将tif文件分解,并获取分解后的路径
//string[] sourceFiles1 = new string[] { @"C:\test\mergeTif_18\1.tif", @"C:\test\mergeTif_18\2.tif",
// @"C:\test\mergeTif_18\3.tif", @"C:\test\mergeTif_18\4.tif",@"C:\test\mergeTif_18\5.tif",@"C:\test\mergeTif_18\11.tif" };
////string[] sourceFiles1 = new string[] { @"C:\test\mergeTif_18\211.tif", @"C:\test\mergeTif_18\411.tif", @"C:\test\mergeTif_18\1.tif" };
//string outFilePath = TiffUtity.SplitTif(sourceFiles1);
////2:将分解后的图片进行jpeg的压缩
//string outFileForCompress = @"C:\test\mergeTif_18\temp";
//string[] sourceFiles = Directory.GetFiles(outFilePath);
//TiffUtity.VaryQualityLevel2(sourceFiles, outFileForCompress);
//string dirPath = @"C:\test\mergeTif_18\temp";
//ArrayList al = new ArrayList();
string dirPath = @"C:\test\mergeTif_18\temp";
string[] bmps = Directory.GetFiles(dirPath);
//string[] bmps = new string[] { @"C:\test\mergeTif\1.tiff", @"C:\test\mergeTif\2.tiff", @"C:\test\mergeTif\3.tif" };
//var result = BitMiracle.GetbitmapsFromTifflist(bmps);
string outputFilePath = @"C:\test\mergeTif_18\mertest.tif";
BitMiracle.Jpegs2Tiff(bmps, outputFilePath, 20);
DateTime dt2 = DateTime.Now;
TimeSpan ts = dt2 - dt1;
this.lblMessage.Text = "cost total time:" + ts.TotalSeconds + "seconds";
MessageBox.Show("done");
}
catch (Exception ex)
{
throw ex;
}
}
---------------------------------------------
private void btnCompressionWithJpeg_Click(object sender, EventArgs e)
{
try
{
this.lblMessage.Text = "";
string sourceFile = @"C:\test\mergeTif_18\411.tif";
string outFile = @"C:\test\mergeTif_18\4111.tif";
TiffUtity.VaryQualityLevel(sourceFile, outFile);
this.lblMessage.Text = "done";
}
catch (Exception ex)
{
throw ex;
}
}
---------------------------------------------
private void btnSplitTif_Click(object sender, EventArgs e)
{
try
{
this.lblMessage.Text = "";
string sourceFile = @"C:\test\mergeTif_18\211.tif";
string outFilePath = @"C:\test\mergeTif_18";
TiffUtity.SplitTif(sourceFile, out outFilePath);
this.lblMessage.Text = "done";
}
catch (Exception ex)
{
throw ex;
}
}