private void ScanNewImage_Button_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image Files(*.jpeg;*.bmp;*.png;*.jpg)|*.jpeg;*.bmp;*.png;*.jpg"; if (open.ShowDialog() == DialogResult.OK) { selectedFile = open.FileName; pictureBox1.Image = new Bitmap(open.FileName); } string scannedText = ImageRecognition.GetTextFromImage(selectedFile); if (scannedText == null) { MessageBox.Show("Image is not valid!"); } else { richTextBox1.Text = scannedText; } }
public Task <string> ScanImageAsync(Bitmap image) => Task.Run(() => ImageRecognition.GetTextFromImage(image));
public Task <string> ScanImageAsync(string selectedFile) => Task.Run(() => ImageRecognition.GetTextFromImage(imagePath: selectedFile));