IRONOCRの使い方 C#でのスクリーンショットからのテキスト取得方法 Kannapat Udonpant 更新日:7月 2, 2025 Download IronOCR NuGet Download テキストの検索と置換 テキストと画像のスタンプ Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article Many people out there may be wondering "What is an OCR Screenshot?" Others might wonder how to convert a screenshot of any text into a digital text-editable format or to .txt, or .doc format. If you are one of these people, then worry no more because we have the perfect solutions for you. In this article, we will discuss different tools that will allow you to perform OCR, Optical Character Recognition, on screenshots. There are many OCR tools out there but today we will be using IronOCR to extract text from screenshots. 1. IronOCR IronOCR is a software library for the C# and VB.NET programming languages, designed to enable developers to add OCR (Optical Character Recognition) capabilities to their applications. The library can be used to recognize text in images and convert it into machine-readable text. The library is built on the Tesseract OCR engine, which is considered one of the most accurate OCR engines available. IronOCR can be used to read text from images in many different file formats, including PNG, JPG, TIFF, and PDF. It also provides a range of advanced features for working with text recognition, such as the ability to recognize multiple languages, as well as the ability to recognize text from images that have been rotated or skewed. Additionally, developers can use IronOCR to quickly integrate OCR functionality into their applications, as it provides a simple, easy-to-use API that can be called from C# or VB.NET code. Using IronOCR, you can choose your OCR language, and perform OCR on images, digital PDF files, and scanned PDF files. IronOCR is considered a good option for developers who want to add OCR functionality to their applications. It's open-source, easy to use and integrate, fast, accurate, and up-to-date with the latest OCR technologies. 2. IronOCR Features IronOCR provides a wide range of features to help developers integrate OCR functionality into their applications. Some of the key features of IronOCR include: Multi-language support: IronOCR can recognize text in over 60 languages, including English, Spanish, German, French, Italian, and Chinese. Automatic detection of text orientation: IronOCR can automatically detect the orientation of text in an image, even if the image has been rotated or skewed. Support for a wide range of image formats: IronOCR can read text from images in many different file formats, including PNG, JPG, TIFF, and PDF. Customizable recognition settings: Developers can customize the recognition settings to improve recognition accuracy for specific types of images or use cases. Ability to recognize text from scanned documents and PDFs with multiple pages. Fast recognition and high accuracy: IronOCR uses the Tesseract OCR engine, which is one of the most accurate and widely used OCR engines available. Easy-to-use API: IronOCR provides a simple, easy-to-use API that can be called from C# or VB.NET code, which makes it easy to integrate OCR functionality into any application. Overall, IronOCR is a powerful tool that provides a wide range of features to help developers add OCR functionality to their applications. 3. Creating a New Project in Visual Studio Open Visual Studio and go to the File menu. Select "New Project" and then select Console Application. Enter the project name and select the path in the appropriate text box. Then, click the Create button. Select the required .NET Framework, as in the screenshot below: Creating a New Project in Visual Studio The Visual Studio project will now generate the structure for the console application. Once finished, it will open the program.cs file, in which you can write and execute source code. The program.cs file, generated from Visual Studio's New Project Wizard Now we can add the IronOCR library and test the program. 4. Install IronOCR In Visual Studio, you can easily integrate IronOCR with your C# project. IronOCR offers multiple processes to integrate with a C# .NET project. Here, we'll discuss one of them: installing IronOCR using the NuGet Package Manager. In Visual Studio go to Tools > NuGet Package Manager > Package Manager Console The NuGet Package Manager UI After clicking, a new console will appear at the bottom of Visual Studio's window. Type the below command in the console and press enter. Install-Package IronOcr IronOCR will be installed in just a few seconds. 5. Using IronOCR to Perform OCR on a Screenshot IronOCR is a powerful OCR library that can be used to recognize text from screenshots. With IronOCR, you can take a screenshot of text, and then use the library's OCR capabilities to convert the text in the screenshot into a digital, editable format. Here's an example of how you might use IronOCR to perform OCR on a screenshot in C#. To perform screenshot OCR, just capture a screenshot and run the below code to extract the text to any output format you want. using IronOcr; using System; class Program { static void Main() { // Create an instance of IronTesseract, the core OCR engine var ocr = new IronTesseract(); // Perform OCR on the specified image file var result = ocr.Read("ocr.png"); // Output the recognized text to the console Console.WriteLine(result.Text); } } using IronOcr; using System; class Program { static void Main() { // Create an instance of IronTesseract, the core OCR engine var ocr = new IronTesseract(); // Perform OCR on the specified image file var result = ocr.Read("ocr.png"); // Output the recognized text to the console Console.WriteLine(result.Text); } } Imports IronOcr Imports System Friend Class Program Shared Sub Main() ' Create an instance of IronTesseract, the core OCR engine Dim ocr = New IronTesseract() ' Perform OCR on the specified image file Dim result = ocr.Read("ocr.png") ' Output the recognized text to the console Console.WriteLine(result.Text) End Sub End Class $vbLabelText $csharpLabel Input Image file Sample Screenshot used for input Text Output - IRONOCR for NET - The C# OCR Library - OCR for C# to scan and read images & PDFs - NET OCR library with 125+ global language packs - Output as text, structured data, or searchable PDFs - Supports NET 6, 5, Core, Standard, Framework 6. Using IronOCR to Perform OCR on a Specific Zone IronOCR allows you to perform OCR on specific zones within an image. This can be useful when the image contains multiple regions of text, and you only want to recognize the text within a specific region. An example code for this is shown below. using IronOcr; using IronSoftware.Drawing; using System; class Program { static void Main() { var ocrTesseract = new IronTesseract(); using (var ocrInput = new OcrInput()) { // Define the rectangle to crop the image for OCR var contentArea = new CropRectangle(x: 0, y: 0, width: 350, height: 150); // Add the image with the specified cropping area ocrInput.AddImage("ocr.png", contentArea); // Perform the OCR operation on the defined area var ocrResult = ocrTesseract.Read(ocrInput); // Output the recognized text Console.WriteLine(ocrResult.Text); } } } using IronOcr; using IronSoftware.Drawing; using System; class Program { static void Main() { var ocrTesseract = new IronTesseract(); using (var ocrInput = new OcrInput()) { // Define the rectangle to crop the image for OCR var contentArea = new CropRectangle(x: 0, y: 0, width: 350, height: 150); // Add the image with the specified cropping area ocrInput.AddImage("ocr.png", contentArea); // Perform the OCR operation on the defined area var ocrResult = ocrTesseract.Read(ocrInput); // Output the recognized text Console.WriteLine(ocrResult.Text); } } } Imports IronOcr Imports IronSoftware.Drawing Imports System Friend Class Program Shared Sub Main() Dim ocrTesseract = New IronTesseract() Using ocrInput As New OcrInput() ' Define the rectangle to crop the image for OCR Dim contentArea = New CropRectangle(x:= 0, y:= 0, width:= 350, height:= 150) ' Add the image with the specified cropping area ocrInput.AddImage("ocr.png", contentArea) ' Perform the OCR operation on the defined area Dim ocrResult = ocrTesseract.Read(ocrInput) ' Output the recognized text Console.WriteLine(ocrResult.Text) End Using End Sub End Class $vbLabelText $csharpLabel Output - IRONOCR for NET - The C# OCR Library - OCR for C# to scan and read images & PDFs - NET OCR library with 125+ global language packs 7. Using IronOCR to Perform OCR on an Image To perform OCR on an image and save the recognized text in a .txt file, you can use the following code. using IronOcr; using System; class Program { static void Main() { var ocr = new IronTesseract(); using (var input = new OcrInput("ocr.png")) { // Perform OCR on the image var result = ocr.Read(input); // Save the recognized text to a .txt file result.SaveAsTextFile("output.txt"); } } } using IronOcr; using System; class Program { static void Main() { var ocr = new IronTesseract(); using (var input = new OcrInput("ocr.png")) { // Perform OCR on the image var result = ocr.Read(input); // Save the recognized text to a .txt file result.SaveAsTextFile("output.txt"); } } } Imports IronOcr Imports System Friend Class Program Shared Sub Main() Dim ocr = New IronTesseract() Using input = New OcrInput("ocr.png") ' Perform OCR on the image Dim result = ocr.Read(input) ' Save the recognized text to a .txt file result.SaveAsTextFile("output.txt") End Using End Sub End Class $vbLabelText $csharpLabel The contents of the output file are shown below: Contents of the generated output.txt file 8. Learn More Read the Image Text Extraction tutorial for more information about how to perform OCR on images. IronOCR is part of a suite of five .NET libraries designed to work with different types of documents. You can purchase all five libraries for the price of just two licenses. よくある質問 C#でOCRを使用してスクリーンショットからテキストを抽出するにはどうすればよいですか? IronOCRをC#で使用してスクリーンショットからテキストを抽出することができます。そのシンプルなAPIを駆使して、スクリーンショットをデジタルテキスト編集可能な形式に変換できます。まず、Visual StudioでNuGetを介してIronOCRをインストールし、次にIronOCRが提供するコード例を使用してスクリーンショット画像でOCRを実行します。 光学文字認識(OCR)とは何ですか? 光学文字認識(OCR)は、スキャナで読み取った紙の書類やPDFファイル、デジタルカメラで撮影された画像など、さまざまな種類のドキュメントを編集可能で検索可能なデータに変換する技術です。IronOCRは、アプリケーション内でOCRを容易にするC#ライブラリです。 IronOCRは複数の言語に対応してOCRを実行できますか? はい、IronOCRは60以上の言語でテキストの認識をサポートしており、国際的なアプリケーションに適しています。テキスト抽出の精度を確保するために言語設定を行うオプションを提供しています。 IronOCRはOCR用のどの画像形式をサポートしていますか? IronOCRは、PNG、JPG、TIFF、PDFを含むさまざまな画像形式でOCRをサポートしています。この柔軟性により、開発者はフォーマットを手動で変換することなく、広範な画像ソースを使用して作業できます。 テキストの方向はOCRの精度にどのように影響しますか? テキストの方向はOCRの精度に大きく影響します。IronOCRは自動的に画像のテキストの方向を検出して修正し、回転または傾斜しているテキストを正確に認識し、デジタル形式に変換します。 C#プロジェクトにIronOCRをインストールするにはどうすればよいですか? C#プロジェクトにIronOCRをインストールするには、Visual StudioのNuGetパッケージマネージャーを使用します。IronOCRを検索してプロジェクトにインストールし、画像からテキストを抽出するためのOCR機能を使用し始めることができます。 テキスト認識にIronOCRを使用する利点は何ですか? IronOCRは、強力な多言語サポート、自動テキスト方向修正、複数画像形式のサポート、および認識精度を向上させるためのカスタマイズ設定など、いくつかの利点を提供します。そのシンプルなAPIは、C#アプリケーションへの簡単な統合を促進します。 IronOCRは画像の特定の領域内のテキストを認識するのに適していますか? はい、IronOCRは開発者が画像内の特定の領域を定義してOCRを実行し、ターゲットとなるテキストを抽出できるようにします。これは、画像の一部分のみが関連するテキストを含むシナリオで役立ちます。 OCRの問題に関する一般的なトラブルシューティングのヒントは何ですか? OCRの問題に関する一般的なトラブルシューティングのヒントには、画像が鮮明で高解像度であることを確認すること、テキストの方向を確認すること、適切な言語が設定されていることを確認すること、および最適なパフォーマンスのためにIronOCRを最新バージョンに更新することが含まれます。 OCR結果を.txtまたは.docファイルに変換するにはどうすればよいですか? IronOCRを使用すると、画像からテキストを抽出し、C#の標準ファイルI/O操作を使用してそれを保存することによって、OCR結果を.txtまたは.docファイルに変換できます。これにより、画像ベースのテキストから編集可能なドキュメントを作成できます。 Kannapat Udonpant 今すぐエンジニアリングチームとチャット ソフトウェアエンジニア ソフトウェアエンジニアになる前に、Kannapatは北海道大学で環境資源の博士号を修了しました。博士号を追求する間に、彼はバイオプロダクションエンジニアリング学科の一部である車両ロボティクスラボラトリーのメンバーになりました。2022年には、C#のスキルを活用してIron Softwareのエンジニアリングチームに参加し、IronPDFに注力しています。Kannapatは、IronPDFの多くのコードを執筆している開発者から直接学んでいるため、この仕事を大切にしています。同僚から学びながら、Iron Softwareでの働く社会的側面も楽しんでいます。コードやドキュメントを書いていない時は、KannapatはPS5でゲームをしたり、『The Last of Us』を再視聴したりしていることが多いです。 関連する記事 公開日 9月 29, 2025 IronOCRを使用して.NET OCR SDKを作成する方法 IronOCRの.NET SDKで強力なOCRソリューションを構築。シンプルなAPI、エンタープライズ機能、クロスプラットフォーム対応。 詳しく読む 公開日 9月 29, 2025 IronOCRを使用してC# GitHubプロジェクトにOCRを統合する方法 OCR C# GitHubチュートリアル:IronOCRを使用してGitHubプロジェクトにテキスト認識を実装。コードサンプルとバージョン管理のヒントを含む。 詳しく読む 更新日 9月 4, 2025 私たちが文書処理メモリを98%削減した方法:IronOCRのエンジニアリングブレークスルー IronOCR 2025.9は、TIFF処理メモリを98%削減するストリーミングアーキテクチャを採用し、クラッシュを回避し、企業のワークフローのために速度を向上。 詳しく読む C#チュートリアルで請求書からテキストを取得する方法C#での字幕のOCR方法(チュ...
公開日 9月 29, 2025 IronOCRを使用して.NET OCR SDKを作成する方法 IronOCRの.NET SDKで強力なOCRソリューションを構築。シンプルなAPI、エンタープライズ機能、クロスプラットフォーム対応。 詳しく読む
公開日 9月 29, 2025 IronOCRを使用してC# GitHubプロジェクトにOCRを統合する方法 OCR C# GitHubチュートリアル:IronOCRを使用してGitHubプロジェクトにテキスト認識を実装。コードサンプルとバージョン管理のヒントを含む。 詳しく読む
更新日 9月 4, 2025 私たちが文書処理メモリを98%削減した方法:IronOCRのエンジニアリングブレークスルー IronOCR 2025.9は、TIFF処理メモリを98%削減するストリーミングアーキテクチャを採用し、クラッシュを回避し、企業のワークフローのために速度を向上。 詳しく読む