473,396 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

read text from image file

198 100+
Hello expert.
I want to make a program in VB in which I have an image file i,e jpg, tif etc.
How can I open this image file and read the text and generate a text file?
If there is any idea then please send me.

Thanks in advance.
Dec 22 '07 #1
12 7984
debasisdas
8,127 Expert 4TB
How the image file contains text?

Still then if you want to open then use in a richtextbox. Using that control you can open any type of file even dll and exe also.
Dec 22 '07 #2
SammyB
807 Expert 512MB
hello expert
i want to make programe in vb in which i have an image file i,e jpg, tif etc
how i can open this image file and read the text and generate a text file .
if there is any idea then please send me

thaks in advance
If you are trying to create a program like OmniPage, you have an enormous task. The characters that you see in an image file are just composed of dots called pixels, there are no ascii characters. Plus, image file formats are pretty tough. HTH --Sam
Dec 22 '07 #3
veer
198 100+
hello expert
i got this code from internet searching but when i execute this code it shows the error that the "aspriseOCR.dll" file was not found but when i have no idea about how the dll file for this code is create please help me by providing some code for the following functions so that if does not show the above error
.................................................. .................................................. .......
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Private Declare Function OCR Lib "AspriseOCR.dll" (ByVal file As String, ByVal imageType As Long) As String
  3. Private Declare Function OCRBarCodes Lib "AspriseOCR.dll" (ByVal file As String, ByVal imageType As Long) As String
  4. Private Declare Function OCRpart Lib "AspriseOCR.dll" (ByVal file As String, ByVal imageType As Long, ByVal startX As Long, ByVal startY As Long, ByVal width As Long, ByVal height As Long) As String
  5.  
  6. Private Sub Check1_Click()
  7.     If Check1.Value = Checked Then
  8.         Command4.Enabled = True
  9.     Else
  10.         Command4.Enabled = False
  11.     End If
  12. End Sub
  13.  
  14. Private Sub Command1_Click()
  15. Dim fnum As Integer
  16.  
  17.     On Error Resume Next
  18.     dlgOpenFile.ShowOpen
  19.     If Err.Number = cdlCancel Then
  20.         ' The user canceled.
  21.         Exit Sub
  22.     ElseIf Err.Number <> 0 Then
  23.         ' Unknown error.
  24.         MsgBox "Error " & Format$(Err.Number) & _
  25.             " selecting file." & vbCrLf & _
  26.             Err.Description
  27.         Exit Sub
  28.     End If
  29.     On Error GoTo 0
  30.  
  31.     ' Read the file.
  32.     'fnum = FreeFile
  33.     'Open dlgOpenFile.FileName For Input As #fnum
  34.     'text.text = Input$(LOF(fnum), fnum)
  35.     'Close #fnum
  36.  
  37.     textPath.text = dlgOpenFile.FileNameEnd Sub
  38.  
  39. Private Sub Command2_Click()
  40.     Dim ret As String
  41.     ret = OCR(textPath.text, -1)
  42.     text.text = ret
  43. End Sub
  44.  
  45. Private Sub Command3_Click()
  46.     Dim ret As String
  47.     ret = OCRBarCodes(textPath.text, -1)
  48.     text.text = ret
  49. End Sub
  50.  
  51. Private Sub Command4_Click()
  52.     Dim ret As String
  53.     ret = OCRpart(textPath.text, -1, CLng(X.text), CLng(Y.text), CLng(W.text), CLng(H.text))
  54.     text.text = ret
  55. End Sub
  56.  
  57. Private Sub Command5_Click()
  58. End
  59. End Sub
  60.  
  61. Private Sub Form_Load()
  62.     dlgOpenFile.InitDir = App.Path
  63.     dlgOpenFile.DialogTitle = "Open File"
  64.     dlgOpenFile.Flags = _
  65.         cdlOFNFileMustExist + _
  66.         cdlOFNHideReadOnly + _
  67.         cdlOFNLongNames + _
  68.         cdlOFNExplorer
  69.     dlgOpenFile.CancelError = True
  70.     Command4.Enabled = False
  71. End Sub
.................................................. ...
If you are trying to create a program like OmniPage, you have an enormous task. The characters that you see in an image file are just composed of dots called pixels, there are no ascii characters. Plus, image file formats are pretty tough. HTH --Sam
Dec 24 '07 #4
debasisdas
8,127 Expert 4TB
The referenced AspriseOCR.dll is not part of VB 6.0 . that is some thirdparty file. You need to have that file in your system to use that.
Dec 24 '07 #5
veer
198 100+
hello expert
i download this file with the code but it is not working with programe
where i will save this file or can i create my own dll file for this code if yes
then give some tips about it

thanks

The referenced AspriseOCR.dll is not part of VB 6.0 . that is some thirdparty file. You need to have that file in your system to use that.
Dec 24 '07 #6
debasisdas
8,127 Expert 4TB
1.copy the file to SYSTEM32 folder
2.register the dll with windows using REGSVR32 key.

then try to use the control.
Dec 24 '07 #7
Killer42
8,435 Expert 8TB
For a Declare statement, I don't think you need to register the DLL. I would recommend copying it into the same directory as your program first, to try it out. But make sure you start VB in that directory, so it is the current one.
Dec 29 '07 #8
VACEPROGRAMER
168 100+
You are crazy!
Try to make a DLL and save in the same folder where VB is installed or just
browse from the VB.

VACE
Dec 29 '07 #9
Killer42
8,435 Expert 8TB
You are crazy!
Try to make a DLL ...
Um... which of us are you responding to, VACEPROGRAMER?
Dec 31 '07 #10
VACEPROGRAMER
168 100+
I'm reponding to veer!!
VACE
Jan 5 '08 #11
veer
198 100+
please responding me about my question

I'm reponding to veer!!
VACE
Jan 9 '08 #12
Killer42
8,435 Expert 8TB
I thought we were waiting on more detail of the latest problem. "Not working" doesn't really tell us very much.
Jan 10 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Phil Powell | last post by:
I have a PHP script that would read in a binary file and display it as if it were <img src>, how would you do that w/o changing the header's MIME type? The entire file does not need to be changed....
12
by: Randy Webb | last post by:
Running Apache2 and PHP 4.3.3 on Windows, is there any way that I can have PHP read an image file and out put its color content? Preferably, I would like for it to read a .bmp file and output a...
5
by: Socrates | last post by:
I am interested in developing an online utility that will enable users to copy and past any image (or upload any image on the internet) to the online utility, which will then convert the image to...
3
by: nicolasg | last post by:
Hi, I'm trying to open a file (any file) in binary mode and save it inside a new text file. After that I want to read the source from the text file and save it back to the disk with its...
2
by: dba123 | last post by:
I need help in coding the following or if you can just point me in the right direction: 1) Reading the follwoing XML document 2) Hook up a GridView to the data received from the XML document. ...
8
by: paraidy | last post by:
Hi all, as from object i need to read all byte from a file example c: \myphoto.jpg and recreate the file with another name to another directory c:\photo\recreatedphoto.jpg can someone write a...
3
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I try to follow Steve's paper to build a database, and store a small text file into SQL Server database and retrieve it later. Only difference between my table and Steve's table is that I use NTEXT...
3
by: ecpbm765 | last post by:
Hey, I am helping to develop a project that displays images based on user input. One possible way of implementing this is via a widget that when it is run, would read in the users input from an...
3
by: sam | last post by:
same as subject?
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.