<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Taresh Chaudhari</title>
    <description>The latest articles on DEV Community by Taresh Chaudhari (@taresh_chaudhari_55c92128).</description>
    <link>https://dev.to/taresh_chaudhari_55c92128</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2479986%2F7e1f8675-332c-46b6-b865-77fea1846ecb.jpg</url>
      <title>DEV Community: Taresh Chaudhari</title>
      <link>https://dev.to/taresh_chaudhari_55c92128</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/taresh_chaudhari_55c92128"/>
    <language>en</language>
    <item>
      <title>Reading Text from Rubber product</title>
      <dc:creator>Taresh Chaudhari</dc:creator>
      <pubDate>Mon, 25 Nov 2024 11:10:34 +0000</pubDate>
      <link>https://dev.to/taresh_chaudhari_55c92128/reading-text-from-rubber-product-5fo0</link>
      <guid>https://dev.to/taresh_chaudhari_55c92128/reading-text-from-rubber-product-5fo0</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fayejyfetx7vlu64cyl7i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fayejyfetx7vlu64cyl7i.png" alt="Image description" width="172" height="63"&gt;&lt;/a&gt;&lt;br&gt;
Hi, &lt;br&gt;
I am trying to read the characters from the image, which has characters with black color in the background. Attaching the code which i used to extract, currently its giving the partial output. Can you help me to guide how to make it accurate? &lt;/p&gt;

&lt;p&gt;import pytesseract&lt;br&gt;
from PIL import Image&lt;br&gt;
pytesseract.pytesseract.tesseract_cmd = 'C:\Users\M562765\AppData\Local\Programs\Tesseract-OCR\tesseract.exe'&lt;/p&gt;

&lt;h1&gt;
  
  
  Paths to your images
&lt;/h1&gt;

&lt;p&gt;image_paths = [&lt;br&gt;
   'C:/Users/M562765/Downloads/Unable-images/Unable/crop1.jpg']&lt;/p&gt;

&lt;h1&gt;
  
  
  Function to process an image and extract text
&lt;/h1&gt;

&lt;p&gt;def extract_text_from_image(image_path):&lt;br&gt;
    # Open the image&lt;br&gt;
    img = Image.open(image_path)&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use pytesseract to perform OCR&lt;br&gt;
extracted_text = pytesseract.image_to_string(img, config='--psm 6')  # PSM 6 assumes a block of text&lt;br&gt;
return extracted_text.strip()&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Process all images and print results&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;for img_path in image_paths:&lt;br&gt;
    text = extract_text_from_image(img_path)&lt;br&gt;
    print(f"Text extracted from {img_path}: {text}")&lt;/p&gt;

</description>
      <category>tesseract</category>
    </item>
  </channel>
</rss>
