IronOCR How-Tos Images (jpg, png, gif, tiff, bmp) How to Read Images Chaknith Bin Updated:July 28, 2025 OCR, or Optical Character Recognition, is a technology that is used to recognize and extract text from images. This technology is particularly useful for digitizing printed documents, as it allows you to extract and work with the textual content from scanned pages, photographs, or other image files. IronOCR supports various image formats, including jpg, png, gif, tiff, and bmp. Image filters are also available to enhance the reading capability. Get started with IronOCR Start using IronOCR in your project today with a free trial. First Step: Start for Free How to Read Images Download a C# library for reading images Support images in various formats, including jpg, png, gif, tiff, and bmp Instantiate the OcrImageInput class to input an image Use the Read method to perform OCR on the input image Specify the crop region to define the reading area Read Images Example Begin by instantiating the IronTesseract class to enable OCR. Utilize the 'using' statement to create an OcrImageInput object, specifying the image file path. This ensures the proper disposal of resources when they are no longer needed. IronOCR supports input images in various formats, including jpg, png, gif, tiff, and bmp. Finally, use the Read method to perform OCR. Please note Starting from version 2025.6: Loading TIFF images now consistently delivers faster performance. Reading TIFF images show performance improvements that depend on the machine's GPU. Some users may experience up to twice the speed, while others may see performance similar to previous versions :path=/static-assets/ocr/content-code-examples/how-to/input-images-read.cs using IronOcr; // Instantiate IronTesseract IronTesseract ocrTesseract = new IronTesseract(); // Add image using var imageInput = new OcrImageInput("Potter.png"); // Perform OCR OcrResult ocrResult = ocrTesseract.Read(imageInput); Imports IronOcr ' Instantiate IronTesseract Private ocrTesseract As New IronTesseract() ' Add image Private imageInput = New OcrImageInput("Potter.png") ' Perform OCR Private ocrResult As OcrResult = ocrTesseract.Read(imageInput) $vbLabelText $csharpLabel Visit the How to Read Multi-Frame/Page GIFs and TIFFs article to learn more about reading TIFF and GIF images. Import Images as Bytes Apart from the plain old filepath, the OcrImageInput class also accepts image information in the form of bytes, AnyBitmap, Stream, as well as Image. The AnyBitmap is a bitmap object of IronSoftware.Drawing.AnyBitmap. :path=/static-assets/ocr/content-code-examples/how-to/input-images-import-byte.cs using IronOcr; using System.IO; // Instantiate IronTesseract IronTesseract ocrTesseract = new IronTesseract(); // Read byte from file byte[] data = File.ReadAllBytes("Potter.tiff"); // Import image byte using var imageInput = new OcrImageInput(data); // Perform OCR OcrResult ocrResult = ocrTesseract.Read(imageInput); Imports IronOcr Imports System.IO ' Instantiate IronTesseract Private ocrTesseract As New IronTesseract() ' Read byte from file Private data() As Byte = File.ReadAllBytes("Potter.tiff") ' Import image byte Private imageInput = New OcrImageInput(data) ' Perform OCR Private ocrResult As OcrResult = ocrTesseract.Read(imageInput) $vbLabelText $csharpLabel Specify Scan Region A CropRectangle is also accepted when instantiating the OcrImageInput class. This allows you to specify which region of the image document should be OCR'ed. Depending on the image document, specifying the region to scan can significantly improve performance. In the code example below, you specify that only the chapter number and title should be read. :path=/static-assets/ocr/content-code-examples/how-to/input-images-read-specific-region.cs using IronOcr; using IronSoftware.Drawing; using System; // Instantiate IronTesseract IronTesseract ocrTesseract = new IronTesseract(); // Specify crop region Rectangle scanRegion = new Rectangle(800, 200, 900, 400); // Add image using var imageInput = new OcrImageInput("Potter.tiff", ContentArea: scanRegion); // Perform OCR OcrResult ocrResult = ocrTesseract.Read(imageInput); // Output the result to console Console.WriteLine(ocrResult.Text); Imports IronOcr Imports IronSoftware.Drawing Imports System ' Instantiate IronTesseract Private ocrTesseract As New IronTesseract() ' Specify crop region Private scanRegion As New Rectangle(800, 200, 900, 400) ' Add image Private imageInput = New OcrImageInput("Potter.tiff", ContentArea:= scanRegion) ' Perform OCR Private ocrResult As OcrResult = ocrTesseract.Read(imageInput) ' Output the result to console Console.WriteLine(ocrResult.Text) $vbLabelText $csharpLabel OCR Result Frequently Asked Questions How can I perform OCR on an image in .NET C#? You can perform OCR on an image in .NET C# by using the IronOCR library. Start by downloading IronOCR from NuGet, instantiate the IronTesseract class, and use the OcrImageInput class to input an image. Then, apply the Read method to extract text from the image. What image formats can be processed using OCR in .NET? IronOCR supports various image formats for OCR processing, including jpg, png, gif, tiff, and bmp. This allows for flexible integration with different types of image files. How can I specify a specific area of an image for OCR in C#? In IronOCR, you can define a specific area of an image to be processed by using a CropRectangle when instantiating the OcrImageInput class. This can improve performance by focusing the OCR operation on a particular region. Is it possible to read images from a byte array for OCR in C#? Yes, IronOCR allows you to input images as byte arrays, AnyBitmap, Stream, or Image. This flexibility enables you to perform OCR on image data available in different formats. How can I ensure efficient memory management during OCR operations in C#? To manage memory efficiently during OCR operations with IronOCR, use the 'using' statement when creating an OcrImageInput object. This ensures that resources are properly disposed of when they are no longer needed. Can I process multi-frame or multi-page images for OCR in C#? Yes, IronOCR supports the reading of multi-frame or multi-page images, such as GIFs and TIFFs. This capability allows you to perform OCR on complex image files containing multiple frames or pages. How can I enhance text recognition in OCR using image filters? IronOCR provides image filters that can be used to enhance text recognition capabilities. By applying these filters, you can improve the accuracy and reliability of the OCR process on various image formats. What are the benefits of using IronOCR for image reading in C#? IronOCR offers several benefits for image reading in C#, including support for multiple image formats, the ability to specify scan regions, and the capability to input images as bytes or streams. These features enable efficient and flexible OCR processing in .NET applications. Chaknith Bin Chat with engineering team now Software Engineer Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience. Reviewed by Jeffrey T. Fritz Principal Program Manager - .NET Community Team Jeff is also a Principal Program Manager for the .NET and Visual Studio teams. He is the executive producer of the .NET Conf virtual conference series and hosts 'Fritz and Friends' a live stream for developers that airs twice weekly where he talks tech and writes code together with viewers. Jeff writes workshops, presentations, and plans content for the largest Microsoft developer events including Microsoft Build, Microsoft Ignite, .NET Conf, and the Microsoft MVP Summit Ready to Get Started? Free NuGet Download Total downloads: 4,306,473 View Licenses