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 What is Optical Character Recognition (OCR)? OCR is a technology used to recognize and extract text from images. It is especially useful for digitizing printed documents, allowing you to work with textual content from scanned pages, photographs, or other image files. Which image formats are supported? Using IronOCR, you can work with various image formats, including jpg, png, gif, tiff, and bmp. How can I get started with image reading in C#? To get started, download the IronOCR library from NuGet, instantiate the IronTesseract class, and use the OcrImageInput class to input an image and perform OCR using the Read method. How do I read an image in .NET? Instantiate the IronTesseract class, use a 'using' statement to create an OcrInput object with the image file path, and call the Read method to perform OCR using IronOCR. Can I read images from a byte array in C#? Yes, by using IronOCR, you can input images in the form of bytes, AnyBitmap, Stream, and Image. Use the OcrInput class with a byte array to perform OCR on image data. How can I specify a scan region for OCR in C# applications? With IronOCR, you can specify a scan region by using a CropRectangle when instantiating the OcrImageInput class. This allows you to define which region of the image should be OCR'ed, potentially improving performance. What is the purpose of using a 'using' statement in image processing? The 'using' statement in IronOCR ensures proper disposal of resources when they are no longer needed, which is crucial for efficient memory management during OCR operations. Can multi-frame or multi-page images be handled in C#? Yes, with IronOCR, you can read multi-frame or multi-page images such as GIFs and TIFFs. Refer to the specific documentation for detailed instructions. 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,072,123 View Licenses