예제 #1
0
        private void Compress_Button_Click(object sender, RoutedEventArgs e)
        {
            OutputFileFormat = ChoisePickUp(FileFormatPanel);

            var outputFileDialog = new System.Windows.Forms.SaveFileDialog()
            {
                InitialDirectory = @"D:\",
                Filter           = OutputFileFormat + "文件(*." + OutputFileFormat + ")" + "|*." + OutputFileFormat,
                RestoreDirectory = true
            };

            if (outputFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                OutputFile = outputFileDialog.FileName;

                var cmdEncodingExe = new StringBuilder(Environment.CurrentDirectory);
                cmdEncodingExe.Append(@".\JPEG2000_MI_Encoding.exe ");
                var cmd = new StringBuilder("-i ");
                cmd.Append(InputFile);
                cmd.Append(" -o ");
                cmd.Append(OutputFile);
                cmd.Append(" -OutFor ");
                cmd.Append(OutputFileFormat.ToUpper());
                cmd.Append(" -r ");
                cmd.Append(CompressionValueLabel.Content.ToString());
                //cmd.Append( " -q " );
                //cmd.Append( QualityValuetextBox.Text );
                cmd.Append(" -n ");
                cmd.Append(ResolutionLabel.Content.ToString());
                cmd.Append(" -b ");
                var size = ChoisePickUp(CodeblockSizePanel).Split('*');
                cmd.Append(size[0]);
                cmd.Append(",");
                cmd.Append(size[1]);
                if (ChoisePickUp(CompressionProfilePanel) == "有损压缩")
                {
                    cmd.Append(" -I ");
                }
                cmd.Append(" -p ");
                cmd.Append(ChoisePickUp(ProgressionOrderPanel));

                System.Diagnostics.Process.Start(cmdEncodingExe.ToString(), cmd.ToString());

                ShowCompress_Button.IsEnabled = true;
            }
        }
예제 #2
0
        private void Decompress_Button_Click(object sender, RoutedEventArgs e)
        {
            //OutputFileFormat = ChoisePickUp(FileFormatPanel);
            OutputFileFormat = "bmp";

            var outputFileDialog = new System.Windows.Forms.SaveFileDialog()
            {
                InitialDirectory = @"D:\",
                Filter           = OutputFileFormat + "文件(*." + OutputFileFormat + ")" + "|*." + OutputFileFormat,
                RestoreDirectory = true
            };

            if (outputFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                OutputFile_JP2 = outputFileDialog.FileName;

                var cmdEncodingExe = new StringBuilder(Environment.CurrentDirectory);
                cmdEncodingExe.Append(@".\JPEG2000_MI_Decoding.exe ");
                var cmd = new StringBuilder("-i ");
                cmd.Append(InputFile_JP2);
                cmd.Append(" -o ");
                cmd.Append(OutputFile_JP2);
                cmd.Append(" -OutFor ");
                cmd.Append(OutputFileFormat.ToUpper());
                cmd.Append(" -r ");
                cmd.Append(ResolutionLabel_Decode.Content.ToString());
                cmd.Append(" -b ");
                if (ChoisePickUp(DecompressionProfile_RGBPanel) == "强行RGB转换")
                {
                    cmd.Append(" -force-rgb ");
                }
                System.Diagnostics.Process.Start(cmdEncodingExe.ToString(), cmd.ToString());

                ShowDecompress_Button.IsEnabled = true;
            }
        }