{"id":398,"date":"2026-10-12T14:28:31","date_gmt":"2026-10-12T04:28:31","guid":{"rendered":"https:\/\/www.cloudproinc.com.au\/?p=398"},"modified":"2026-10-12T14:28:31","modified_gmt":"2026-10-12T04:28:31","slug":"extract-text-from-images-using-azure-ai-vision","status":"publish","type":"post","link":"https:\/\/www.cloudproinc.com.au\/index.php\/2026\/10\/12\/extract-text-from-images-using-azure-ai-vision\/","title":{"rendered":"Extract Text from Images Using Azure AI Vision"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this Azure AI Vision blog post, we will show how to extract text from images using Azure AI Vision and Azure SDK for .NET.<\/p>\n\n\n\n<!--more-->\n\n\n\n<ul class=\"wp-block-list\">\n<li>Azure AI Vision allows us to analyse images and perform operations against objects inside images. AI Vision capabilities include:<\/li>\n\n\n\n<li>Optical Character Recognition (OCR) allows us to extract text from images, whether they are printed or handwritten, as we will see in this post.<\/li>\n\n\n\n<li>Extract visual features, generate captions, and identify faces and objects.<\/li>\n\n\n\n<li>Recognise human faces for facial recognition software, including image blurring and access control.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">To perform AI operations on images, we use the official Microsoft Azure SDK for .NET. The AI Vision library is called <code>Azure.AI.Vision.ImageAnalysis<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-deploy-azure-ai-vision-resource\">Deploy Azure AI Vision Resource<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before accessing the AI Vision service, we need to deploy an Azure resource that will give us access to the service. To deploy the service, we can either use the Azure portal, Azure PowerShell, Azure CLI, or the .NET SDK for Azure. In our case, we will use Azure <a href=\"https:\/\/ntweekly.com\/category\/bicep\/\" target=\"_blank\" rel=\"noreferrer noopener\">Bicep<\/a> with the following configuration.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-1\"><code>resource aivision 'Microsoft.CognitiveServices\/accounts@2023-05-01' = {\n  name: 'CognitiveServices'\n  location: 'southeastasia'\n \n  sku: {\n    name: 'S0'\n  }\n  kind: 'ComputerVision'\n  properties: {\n   \n  }\n \n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once the service is deployed, Open the resource from the Azure portal and note the API Key and Endpoint.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1024\" height=\"347\" data-src=\"\/wp-content\/uploads\/2024\/07\/image-20-1024x347.png\" alt=\"\" class=\"wp-image-399 lazyload\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/347;width:821px;height:auto\" data-srcset=\"\/wp-content\/uploads\/2024\/07\/image-20-1024x347.png 1024w, \/wp-content\/uploads\/2024\/07\/image-20-300x102.png 300w, \/wp-content\/uploads\/2024\/07\/image-20-768x260.png 768w, \/wp-content\/uploads\/2024\/07\/image-20-1536x520.png 1536w, \/wp-content\/uploads\/2024\/07\/image-20-1080x366.png 1080w, \/wp-content\/uploads\/2024\/07\/image-20-1280x433.png 1280w, \/wp-content\/uploads\/2024\/07\/image-20-980x332.png 980w, \/wp-content\/uploads\/2024\/07\/image-20-480x163.png 480w, \/wp-content\/uploads\/2024\/07\/image-20.png 1642w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-program\">Program <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have the service deployed to Azure and the access details to the service, we can use the AI Vision library to detect an image and give us a description of it.  Start by creating a C# console application and installing the Vision library.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-2\"><code>dotnet add package Azure.AI.Vision.ImageAnalysis --version 1.0.0-beta.3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the program root directory, create an Images directory and copy all the images from which you need AI Vision to extract text.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-3\"><code>using System;\nusing System.IO;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Text.Json;\nusing System.Threading.Tasks;\nusing System.Drawing;\nusing Microsoft.Extensions.Configuration;\nusing Azure;\nusing Azure.AI.Vision.ImageAnalysis;  \/\/ AI Vision namespace\n\npublic class Program\n{\n    static void Main()\n    {\n        AnalyzeImages();\n    }\n\n    static void AnalyzeImages()\n    {\n        \/\/ Get config settings from AppSettings\n        IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile(\"appsettings.json\");\n        IConfigurationRoot configuration = builder.Build();\n        string aiSvcEndpoint = configuration&#91;\"AIServicesEndpoint\"];\n        string aiSvcKey = configuration&#91;\"AIServicesKey\"];\n\n        ImageAnalysisClient client = new ImageAnalysisClient(\n            new Uri(aiSvcEndpoint),\n            new AzureKeyCredential(aiSvcKey));\n\n        string&#91;] imageFiles = Directory.GetFiles(\"images\");\n        foreach (string imageFile in imageFiles)\n        {\n            using FileStream stream = new FileStream(imageFile, FileMode.Open);\n\n            ImageAnalysisResult result = client.Analyze(\n                BinaryData.FromStream(stream),\n                VisualFeatures.Read);\n\n\n            foreach (DetectedTextBlock block in result.Read.Blocks)\n                foreach (DetectedTextLine line in block.Lines)\n                {\n                    Console.WriteLine($\"   Line: '{line.Text}'\");\n                    foreach (DetectedTextWord word in line.Words)\n                    {\n                        Console.WriteLine($\"     Word: '{word.Text}', Confidence {word.Confidence.ToString(\"#.####\")}\");\n                    }\n                }\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Before you run the program, add your Azure AI Vision resource Key and Endpoint to an appsettings.json file. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the example below, I will extract the text from the image above (from the Azure portal).<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-4\"><code>  Line: 'to make an API call. When regenerating the first key, you can use the second key for continued access to the'\n     Word: 'to', Confidence .999\n     Word: 'make', Confidence .984\n     Word: 'an', Confidence .998\n     Word: 'API', Confidence .958\n     Word: 'call.', Confidence .996\n     Word: 'When', Confidence .993\n     Word: 'regenerating', Confidence .994\n     Word: 'the', Confidence .999\n     Word: 'first', Confidence .994\n     Word: 'key,', Confidence .987\n     Word: 'you', Confidence .999\n     Word: 'can', Confidence .998\n     Word: 'use', Confidence .993\n     Word: 'the', Confidence .999\n     Word: 'second', Confidence .996\n     Word: 'key', Confidence .998\n     Word: 'for', Confidence .998\n     Word: 'continued', Confidence .994\n     Word: 'access', Confidence .996\n     Word: 'to', Confidence .999\n     Word: 'the', Confidence .999\n   Line: 'Tags'\n     Word: 'Tags', Confidence .991\n   Line: 'service.'\n     Word: 'service.', Confidence .994\n   Line: 'X Diagnose and solve problems'\n     Word: 'X', Confidence .578\n     Word: 'Diagnose', Confidence .994\n     Word: 'and', Confidence .999\n     Word: 'solve', Confidence .998\n     Word: 'problems', Confidence .993\n   Line: 'Show Keys'\n     Word: 'Show', Confidence .993\n     Word: 'Keys', Confidence .99\n   Line: 'V Resource Management'\n     Word: 'V', Confidence .882\n     Word: 'Resource', Confidence .994\n     Word: 'Management', Confidence .993\n   Line: 'KEY 1'\n     Word: 'KEY', Confidence .998\n     Word: '1', Confidence .959\n   Line: 'Keys and Endpoint'\n     Word: 'Keys', Confidence .993\n     Word: 'and', Confidence .999\n     Word: 'Endpoint', Confidence .993\n   Line: '...'\n     Word: '...', Confidence .959\n   Line: '.......................'\n     Word: '.......................', Confidence .782\n   Line: 'Pricing tier'\n     Word: 'Pricing', Confidence .751\n     Word: 'tier', Confidence .993\n   Line: 'KEY 2'\n     Word: 'KEY', Confidence .998\n     Word: '2', Confidence .997\n   Line: '( ... )'\n     Word: '(', Confidence .179\n     Word: '...', Confidence .731\n     Word: ')', Confidence .885\n   Line: 'Networking'\n     Word: 'Networking', Confidence .995\n   Line: 'Identity'\n     Word: 'Identity', Confidence .959\n   Line: 'Location\/Region r'\n     Word: 'Location\/Region', Confidence .975\n     Word: 'r', Confidence .127\n   Line: 'L'\n     Word: 'L', Confidence .416\n   Line: '$ Cost analysis'\n     Word: '$', Confidence .63\n     Word: 'Cost', Confidence .993\n     Word: 'analysis', Confidence .994\n   Line: 'southeastasia'\n     Word: 'southeastasia', Confidence .993\n   Line: 'I!| Properties'\n     Word: 'I!|', Confidence .5\n     Word: 'Properties', Confidence .989\n   Line: 'Endpoint'\n     Word: 'Endpoint', Confidence .995\n   Line: 'Locks'\n     Word: 'Locks', Confidence .996\n   Line: 'https:\/\/southeastasia.api.cognitive.microsoft.com\/'\n     Word: 'https:\/\/southeastasia.api.cognitive.microsoft.com\/', Confidence .903\n   Line: 'V'\n     Word: 'V', Confidence .963\n   Line: 'Security'\n     Word: 'Security', Confidence .994<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At CPI, we help many businesses develop AI solutions using Azure AI Services. Please contact us if you need assistance with your development.<\/p>\n\n\n<div class=\"wp-block-jetpack-contact-form is-layout-flex wp-container-jetpack-contact-form-is-layout-53c17e14 wp-block-jetpack-contact-form-is-layout-flex\"><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2026\/10\/12\/extract-text-from-images-using-azure-ai-vision\/\" target=\"_blank\" rel=\"noopener noreferrer\">Submit a form.<\/a><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-related-articles\">Related Articles <\/h2>\n\n\n\n<ul class=\"wp-block-yoast-seo-related-links yoast-seo-related-links\">\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2024\/07\/21\/integrating-azure-ai-vision-for-image-analysis-in-c-applications\/\">Integrating Azure AI Vision for Image Analysis in C# Applications<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2024\/07\/21\/retrieving-azure-ai-services-keys-and-endpoints-using-bicep\/\">Retrieving Azure AI Services Keys and Endpoints Using Bicep<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2024\/03\/28\/how-to-add-a-registry-key-to-windows-11-using-microsoft-intune\/\">How to Add a Registry Key to Windows 11 Using Microsoft Intune<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/about\/\">About<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.cloudproinc.com.au\/index.php\/2024\/07\/11\/list-classic-azure-administrators-using-powershell-and-azure-rest-api\/\">List Classic Azure Administrators Using PowerShell and Azure REST API<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Azure AI Vision blog post, we will show how to extract text from images using Azure AI Vision and Azure SDK for .NET.<\/p>\n","protected":false},"author":1,"featured_media":400,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[24,16,26,23,13],"tags":[],"class_list":["post-398","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-microsoft-azure","category-azure-ai-services","category-azure-ai-vision","category-blog"],"jetpack-related-posts":[{"id":414,"url":"https:\/\/www.cloudproinc.com.au\/index.php\/2026\/10\/12\/generate-an-image-caption-with-azure-ai-vision-and-net\/","url_meta":{"origin":398,"position":0},"title":"Generate an Image Caption With Azure AI Vision and .NET","author":"CPI Staff","date":"October 12, 2026","format":false,"excerpt":"This Azure AI Vision article will show how to generate an image caption with Azure AI Vision and .NET C# application. Azure AI Vision is a Microsoft Azure service that is part of the Azure AI Services suite of cloud services, which also includes speech services and the popular Azure\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/www.cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/07\/Generate-an-Image-Caption-With-Azure-AI-Vision-and-.NET_.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/07\/Generate-an-Image-Caption-With-Azure-AI-Vision-and-.NET_.webp 1x, \/wp-content\/uploads\/2024\/07\/Generate-an-Image-Caption-With-Azure-AI-Vision-and-.NET_.webp 1.5x, \/wp-content\/uploads\/2024\/07\/Generate-an-Image-Caption-With-Azure-AI-Vision-and-.NET_.webp 2x"},"classes":[]},{"id":390,"url":"https:\/\/www.cloudproinc.com.au\/index.php\/2026\/10\/12\/integrating-azure-ai-vision-for-image-analysis-in-c-applications\/","url_meta":{"origin":398,"position":1},"title":"Integrating Azure AI Vision for Image Analysis in C# Applications","author":"CPI Staff","date":"October 12, 2026","format":false,"excerpt":"This Azure AI Services article will show how to integrate Azure AI Vision for image analysis in C# applications using .NET. Azure AI Services offers access to many AI services, including the popular Azure OpenAI service. Today, we will focus on Azure AI Vision, which offers AI capabilities when working\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/www.cloudproinc.com.au\/index.php\/category\/ai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/07\/Integrating-Azure-AI-Vision-for-Image-Analysis-in-C-Applications.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/07\/Integrating-Azure-AI-Vision-for-Image-Analysis-in-C-Applications.webp 1x, \/wp-content\/uploads\/2024\/07\/Integrating-Azure-AI-Vision-for-Image-Analysis-in-C-Applications.webp 1.5x, \/wp-content\/uploads\/2024\/07\/Integrating-Azure-AI-Vision-for-Image-Analysis-in-C-Applications.webp 2x"},"classes":[]},{"id":459,"url":"https:\/\/www.cloudproinc.com.au\/index.php\/2026\/10\/12\/reading-handwriting-with-azure-ai-vision-and-net-c\/","url_meta":{"origin":398,"position":2},"title":"Reading Handwriting with Azure AI Vision and .NET C#","author":"CPI Staff","date":"October 12, 2026","format":false,"excerpt":"This Azure AI Vision article will show you how to create a .NET app that reads handwritten text using Azure AI Vision. Microsoft Azure AI Services offers several AI services that can help streamline business processes or create in-house applications that can replace SaaS apps. Azure AI Vision allows us\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/www.cloudproinc.com.au\/index.php\/category\/net\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 1x, \/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 1.5x, \/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 2x"},"classes":[]},{"id":751,"url":"https:\/\/www.cloudproinc.com.au\/index.php\/2026\/10\/12\/generate-dall-e-images-with-net-c-console-application\/","url_meta":{"origin":398,"position":3},"title":"Generate DALL-E Images with .NET C# Console Application","author":"CPI Staff","date":"October 12, 2026","format":false,"excerpt":"This Azure OpenAI article will show you how to generate DALL-E images with .NET C# Console application using the Azure SDK for .NET. Table of contentsAzure SDK for .NETGenerate DALL-E Images with .NET C# Console ApplicationInstall-PackageProgram.csRelated Articles Azure SDK for .NET allows us to build Gen-AI applications using .NET, the\u2026","rel":"","context":"In &quot;.NET&quot;","block_context":{"text":".NET","link":"https:\/\/www.cloudproinc.com.au\/index.php\/category\/net\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 1x, \/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 1.5x, \/wp-content\/uploads\/2024\/07\/Reading-Handwriting-with-Azure-AI-Vision-and-.NET-C.webp 2x"},"classes":[]},{"id":753,"url":"https:\/\/www.cloudproinc.com.au\/index.php\/2026\/10\/12\/generate-images-with-azure-openai-dall-e-and-postman\/","url_meta":{"origin":398,"position":4},"title":"Generate Images with Azure OpenAI DALL-E and Postman","author":"CPI Staff","date":"October 12, 2026","format":false,"excerpt":"In this Azure OpenAI DALL-E article, we will show you how to generate images with Azure OpenAI DALL-E and Postman. Table of contentsDeploy Resource and AI ModelGenerate Images with Azure OpenAI DALL-E and PostmanRelated Articles Azure OpenAI DALL-E offers the latest text-to-image generation model, DALL-E 3. The model offers advanced\u2026","rel":"","context":"In &quot;Azure OpenAI&quot;","block_context":{"text":"Azure OpenAI","link":"https:\/\/www.cloudproinc.com.au\/index.php\/category\/azure-openai\/"},"img":{"alt_text":"","src":"\/wp-content\/uploads\/2024\/07\/How-to-Use-Microsoft-Graph-Security-API.webp","width":350,"height":200,"srcset":"\/wp-content\/uploads\/2024\/07\/How-to-Use-Microsoft-Graph-Security-API.webp 1x, \/wp-content\/uploads\/2024\/07\/How-to-Use-Microsoft-Graph-Security-API.webp 1.5x, \/wp-content\/uploads\/2024\/07\/How-to-Use-Microsoft-Graph-Security-API.webp 2x, \/wp-content\/uploads\/2024\/07\/How-to-Use-Microsoft-Graph-Security-API.webp 3x, \/wp-content\/uploads\/2024\/07\/How-to-Use-Microsoft-Graph-Security-API.webp 4x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"\/wp-content\/uploads\/2024\/07\/Extract-text-from-images-using-Azure-AI-Vision.webp","_links":{"self":[{"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=398"}],"version-history":[{"count":1,"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/398\/revisions"}],"predecessor-version":[{"id":401,"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/posts\/398\/revisions\/401"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media\/400"}],"wp:attachment":[{"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudproinc.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}