How to convert image(jpg) to text / word using shell command?
https://www.zyxware.com/sites/default/files/styles/user_image/public/default_images/index.png?itok=2YmREnrP
BY premshankar.pb
3 years ago
Bash
0
comments comment

Converting the jpg to text is done by OCR(Optical character reading). There are lot of online OCR services available now. But these services set a limit in the input file size we are feeding. So the best option is to do conversion through the shell command. Here I explain the conversion using the shell commands.

Convertion of image to text

To convert the image to text, we are using tesseract OCR. For using tesseract we should install the tesseract in our system.
For that use the code:

sudo apt-get install tesseract-ocr

The tesseact OCR will only process files with .tif format. So we should convert our image files to tif format. So we should need an image processing application. Here I use ImageMagick. For installing use the code:

sudo apt-get install imagemagick

After the successful installation, convert the image file to tif format. For that use command:

convert 1.jpg foo.tif

Now you have your tif file in your directory. Convert this tif to txt file. For that use command:

tesseract foo.tif foo

You will get a foo.txt file in your folder.

Hope this helps. Please fell free to share your thoughts and doubts regarding this here.


RELATED ARTICLE

more_horiz
close

on 11th December 2008 / by webmaster
Recently we had to provide support on a Red Hat Server where there were hundreds of users and the user directories organized into hierarchies. Normally we change to a users directory using cd ~username. We had some extra time on our hands and wanted to play with the /etc/passwd file and tried to use awk to do the same thing. The following one liner will do this the hard way :-) Linux Shell Scripting Bash Leave a reply Your email address will not be published. Required fields are marker * cherry (not verified) access_time 18 Aug 2019 - 18:08 alternatively: cd `(cat /etc/passwd|grep username|cut -d ':' -f 6` ;-) Add new comment
close

on 12th December 2009 / by webmaster
Asianet Dataline is an ISP in Kerala and they use a web browser based authentication system to lo Internet Shell Scripting Bash Asianet Leave a reply Your email address will not be published. Required fields are marker * Vivek Thomas (not verified) access_time 18 Aug 2019 - 18:08 Thank you very much for this. Works great. Btw I had to add a --no-check-certificate option in the following line for it get the login URL. :) asianet_conn_url=`wget --quiet --no-check-certificate -O - www.zyxware.com|grep 'action='|sed 's/\(.*action="\)\(.*\)">/\2/g'` webmaster access_time 18 Aug 2019 - 18:08 In reply to Thank you very much for this. by Vivek Thomas (not verified) Changes duly made in git repo and credit given. Anoop JITHIN (not verified) access_time 18 Aug 2019 - 18:08 In reply to Thanks by webmaster Sir, Where is this "Favorite Scripts Folder" How Can I Copy A Script ie In Text Form To A Folde? Is Favorite Script Folder an attachment Of Internet Explorer Browser ? Please Tell Me About "START UP PROCESS" Can You Plese Explain What Should I Do Step By Step Considering Me As A Beginer. Jimmy (not verified) access_time 18 Aug 2019 - 18:08 Hi, I see the script. Can I use this script in Windows? If yes, please tell me the complete procedure to use this script in windows using the browser IE. Thanks Jimmy Anonymous (not verified) access_time 18 Aug 2019 - 18:08 Thank you very much for this. Works great. But I cant logout after use Add new comment
more_horiz
close

on 14th December 2012 / by thomas.john
The default method of changing a Drupal theme using the graphical Admin interface is familiar to most Drupal users. However a Drupal user is limited to changing only one theme at a time using this method and it is also slightly time consuming. What if you want to enable more then one theme at a time? Drupal provides a quicker way to change the theme using the bash command line. Read on to know how to enable multiple Drupal themes using the bash command line Drupal Bash Drupal Themes Drupal Theming Drush Leave a reply Your email address will not be published. Required fields are marker *
Leave a reply
Your email address will not be published. Required fields are marker *

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
The content of this field is kept private and will not be shown publicly.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.