private void annotateButton_Click(object sender, EventArgs e) { try { using (OpenFileDialog opn = new OpenFileDialog()) { opn.Title = "Select images to Annotate..."; opn.Multiselect = true; opn.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (opn.ShowDialog() == DialogResult.OK) { using (SaveFileDialog sve = new SaveFileDialog()) { sve.Title = "Please enter target path for the annotated tiff..."; sve.DefaultExt = "tif"; sve.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (sve.ShowDialog() == DialogResult.OK) { TiffDll_Methods.AnnotateTiff(opn.FileName, sve.FileName, "[ T E S T A N N O T A T I O N ] Date: " + DateTime.Now.ToString(), false, ContentAlignment.BottomRight); } } } } } catch (Exception ex) { TiffDll_Methods.errorList.Add(string.Format("Error in [{0}], error: [{1}]", MethodBase.GetCurrentMethod().Name, ex.ToString())); } finally { AddLoggerLines(); } }
private void imageInfoButton_Click(object sender, EventArgs e) { try { using (OpenFileDialog opn = new OpenFileDialog()) { opn.Title = "Select image to get its information"; opn.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (opn.ShowDialog() == DialogResult.OK) { Size sz = new Size(); Size rs = new Size(); int pages = 0; int compression = -1; int colorDepth = -1; if (TiffDll_Methods.GetImageInfo(opn.FileName, ref sz, ref rs, ref pages, ref compression, ref colorDepth)) { MessageBox.Show(string.Format("Image Path: {0}\r\nSize: {1}\r\nResolution: {2}\r\nNumber Of Pages: {3}\r\nCompression: {4}\r\nColor Depth: {5}", opn.FileName, sz, rs, pages, compression, colorDepth), "Image information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception ex) { TiffDll_Methods.errorList.Add(string.Format("Error in [{0}], error: [{1}]", MethodBase.GetCurrentMethod().Name, ex.ToString())); } finally { AddLoggerLines(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void changeResolutionButton_Click(object sender, EventArgs e) { try { using (OpenFileDialog opn = new OpenFileDialog()) { opn.Title = "Select image to change resolution to 300dpi"; opn.Multiselect = false; opn.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (opn.ShowDialog() == DialogResult.OK) { using (SaveFileDialog sve = new SaveFileDialog()) { sve.Title = "Please enter target path for the changed resolution tiff"; sve.DefaultExt = "tif"; sve.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (sve.ShowDialog() == DialogResult.OK) { TiffDll_Methods.ChangeTiffResolution(opn.FileName, sve.FileName, 300); } } } } } catch (Exception ex) { TiffDll_Methods.errorList.Add(string.Format("Error in [{0}], error: [{1}]", MethodBase.GetCurrentMethod().Name, ex.ToString())); } finally { AddLoggerLines(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void joinButton_Click(object sender, EventArgs e) { try { using (OpenFileDialog opn = new OpenFileDialog()) { opn.Title = "Select images to join..."; opn.Multiselect = true; opn.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (opn.ShowDialog() == DialogResult.OK && opn.FileNames.Length > 1) { using (SaveFileDialog sve = new SaveFileDialog()) { sve.Title = "Please enter target path for the joined tiff"; sve.DefaultExt = "tif"; sve.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (sve.ShowDialog() == DialogResult.OK) { TiffDll_Methods.JoinTiffPages(sve.FileName, opn.FileNames); } } } } } catch (Exception ex) { TiffDll_Methods.errorList.Add(string.Format("Error in [{0}], error: [{1}]", MethodBase.GetCurrentMethod().Name, ex.ToString())); } finally { AddLoggerLines(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void splitButton_Click(object sender, EventArgs e) { try { using (OpenFileDialog opn = new OpenFileDialog()) { opn.Title = "Select image to split (result files will be placed next to it)"; opn.Multiselect = false; opn.Filter = "Tiff files (*.tif)|*.tiff;*.tif|Any file (*.*)|*.*"; if (opn.ShowDialog() == DialogResult.OK) { TiffDll_Methods.SplitTiffPages(opn.FileName, null, null); } } } catch (Exception ex) { TiffDll_Methods.errorList.Add(string.Format("Error in [{0}], error: [{1}]", MethodBase.GetCurrentMethod().Name, ex.ToString())); } finally { AddLoggerLines(); } }