SaveJPEG() static private method

static private SaveJPEG ( Image image, string jpegFileName ) : bool
image Image
jpegFileName string
return bool
Example #1
0
        internal void TakePicture()
        {
            if ((m_takePictureAsync == null) && (m_cam != null))
            {
                if (m_countdownTimer != null)
                {
                    m_countdownTimer.Abort();
                    m_countdownTimer = null;
                }

                pictureBox.Text    = Language.FormatString(Language.LanguageString.MainForm_TakePicture_TakingPicture);
                m_takePictureAsync = new TakePicture(m_cam.TakePicture);
                m_takePictureAsync.BeginInvoke((AsyncCallback) delegate(IAsyncResult result) {
                    try {
                        pictureBox.DisplayBitmap = m_takePictureAsync.EndInvoke(result);
                        Invoke((MethodInvoker) delegate() {
                            try {
                                Common.SaveJPEG(pictureBox.DisplayBitmap, Path.Combine(Settings.OutputFolder, m_fileName));
                                pictureBox.Text = string.Empty;
                            } catch (Exception) {
                                pictureBox.Text = Language.FormatString(Language.LanguageString.NotifyForm_FailedToSave) + "\r\n" + m_fileName;
                            }
                        });
                    } catch (Exception) {
                        Invoke((MethodInvoker) delegate() {
                            pictureBox.Text = Language.FormatString(Language.LanguageString.NotifyForm_FailedToTakePicture);
                        });
                    } finally {
                        m_takePictureAsync = null;
                        CountdownTimerSetup();
                    }
                }, null);
            }
        }
Example #2
0
 private void savePictureButton_Click(object sender, EventArgs e)
 {
     takePictureSaveDialog.Title    = Language.FormatString(Language.LanguageString.MainForm_TakePicture_SaveDialogTitle);
     takePictureSaveDialog.FileName = Path.Combine(confFolder.Text, Common.GenerateFilename(confFilename.Text));
     if (takePictureSaveDialog.ShowDialog(this) == DialogResult.OK)
     {
         Common.SaveJPEG(takePicturePicture.DisplayBitmap, takePictureSaveDialog.FileName);
     }
 }