Solved

Using a scanner

Posted on 1998-03-05
26
334 Views
Last Modified: 2010-04-04
Hi experts!

I have to recieve an image from the scanner and save it as TIFF. So I need to find some dll or a component or an OCX -whatever.
This should be done from Delphi of course.

Do you know where I can find something or how to make one(of course for much more points!!!)?

Thanks!

Regards,
Matvey
0
Comment
Question by:Matvey
  • 12
  • 9
  • 3
  • +1
26 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1360166
Hi friend,

For SCSI scanners the way to scanning is an interface DLL called TWAIN. But, I want to ask if you have a image manupulation and format conversion application? If so, there is a marvelous OCX from Accusoft called ImageGear. It has even image processing and enhancement functions, but it is expensive. Please describe your need more?

Bye
Igor
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360167
Yo Matvey,

On Super Delphi Page and/or Torry's Page there is called a component which interacts with Twain DLL...

Regards, Zif.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360168
Yo Matvey,

On Super Delphi Page and/or Torry's Page there is called a component which interacts with Twain DLL...

Regards, Zif.
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360169
Hi guys,

I heard about ImageGear...and about it's price. In fact I didn't know it does some kind of job for scanners...

Anyway, my task seems to be simpler: all I need is to scan and save.

ZifNab -thanks. I'll look at it today.
0
 
LVL 1

Accepted Solution

by:
Odie earned 100 total points
ID: 1360170
I had the same problem and I used the Wang-Image scanning control that comes with any new version of Windows.  It's an ocx control which envokes the twain-stuff and let's the user selected the area to scan, resolution etc.  It also let's the programmer select to save the image as jpeg, tiff or bmp.
It's easy to use for the programmer.
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360171
Odie, what do you mean any new Win. ver? Where exactly I can find this OCX?

Thanks!!!
0
 
LVL 5

Expert Comment

by:inter
ID: 1360172
Hi Matvey,

The WangImage controls are installed in any WinNT 4.0 version as far as I know. For Win95 they are not standard components but available with Plus kit. So if you are running NT 4.0 and Delphi 2.0+, you should see them in registered OCX. Just install them to VCL.  But I do not use them before, so Odie may help with code fragments.

Bye friend, (I'll send you the TSortGrid and TCheckGrid, sorry for the delay)
Igor
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360173
Hi all!

To be clear:
I'm using Win95 with Delphi 3 pro.
I got the "Plus!" thing

I'll try to search for it (wang...) wherever it is, but my last atempt was unseccessful

My task now looks like this:
I have to make a sort of DLL file that will have a procedure that recieves a filename, scans  a paper and saves it to this file.

*The file is TIFF

*I think I should use TWAIN (whatevr it is -I don't really know...)

What I've got so far it's a shareware delphi component that can NOT write TIFF, for it I'll need some sort of file convertion component. (do you know any???)

I also have now the idea of WANG that Odie sugested. -Again very unclear situation.

So...what do you say? let's make it clear??

THANK YOU ALL SO MUCH!!!

PS Inter, Zif sent me the SortGrid, but not the others -thanks!
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360174
Yo Matvey, that TWAIN thing is a DLL file...
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360175
:-) It might be whatever animal, but my task is to make a procedure that uses it as I described.

Can you help?
0
 
LVL 1

Expert Comment

by:Odie
ID: 1360176
Sorry it took me so long to answer (and my previous thing was meant to be a comment - wrong button).  With new version I mean that the first version of windows 95 didn't have the component but the OSR2 release for example does.  It is installed when you check the installation option 'Imaging'.
And it does automatically convert the scanned image to tif/jpg/bmp.
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360177
Yes! I found it! although I had no "Wang Imaging" with my w95, I found the separate Install!

Now I need two things:
Maybe you can send me some example you have made with this? It'll be really helpfull!
And I need to know if I can freelly use imaging OCXes and destribute them.

Thanks alot Odie!
Matvey

my email: bosism@netvision.net.il
0
 
LVL 1

Expert Comment

by:Odie
ID: 1360178
This is the core code of the stuff.  This is only testing code (I use a constant path c:\y.bmp e.g.).  Note that some properties set with the object inspector are 'forgotten' by the component so I set these things again at run time (compressiontype and filetype).

After this code has run, the image is in ProgramData.ScannedImage and stays there (for displaying - zooming).

  if (ProgramData.ScannedImage != NULL) {
    delete ProgramData.ScannedImage;
  }

  ImgScanner->Image = "c:\\y.bmp";
  ImgScanner->FileType = 3;
  ImgScanner->CompressionType = 1;
  ImgScanner->StartScan();

  ProgramData.ScannedImage = new TPicture;
  ProgramData.ScannedImage->LoadFromFile("C:\\y.bmp");
  XMax = ProgramData.ScannedImage->Width;
  YMax = ProgramData.ScannedImage->Height;

Hope it works!
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:Odie
ID: 1360179
Sorry - thought I was in c++, for delphi this should be something like:

If (Programdata.ScannedImage <> nil) then begin
  ProgramData.ScannedImage.Free;
end;

ImgScanner.Image := 'C:\Y.Bmp';
ImgScanner.FileType := 3;
ImgScanner.CompressionType := 1;
ImgScanner.StartScan;

ProgramData.ScannedImage := TPicture.Create;
ProgramData.ScannedIMage.LoadFromFile('C:\Y.bmp');

0
 
LVL 3

Author Comment

by:Matvey
ID: 1360180
Odie, I was playing today for a very long time with this component but I couldn't get it save files as TIFF. Can you try to do this? because I have some really stupid problem...

Thanks!

Cheers,
Matvey

(POINTS=100)
0
 
LVL 1

Expert Comment

by:Odie
ID: 1360181
Oh yes, but maybe it's my fault.  The FileType and CompressionType specify (and you must set it at runtime) what the file-format is.  You can see the numbers of this in the object-inspector.

I will also try this (I haven't tried it with tiff) - but maybe this may help you on your way faster.
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360182
FileType for the ImgScan? -let's try...
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360183
Odie, I tested the same procedure with VB and with Delphi (the saveas proc), and Delphi seems to have a problem!!! It doesn't saves the file!!! Did you try to save files of any type?

If you have an example that works please send it to me (email above), so I can see what  is really wrong here...

Big thanks!
0
 
LVL 1

Expert Comment

by:Odie
ID: 1360184
OK I'll check (note: I tested it with C++Builder).
0
 
LVL 1

Expert Comment

by:Odie
ID: 1360185
Sorry for the delay - but when I try it, it works.  Haven't you forgotten to set the component to save it as a file only?  (you can choose between display/file/both/...)  Haven't you forgotten setting the image property (maybe try it at runtime too - the component might 'forget')?
This is my working code:

  ImgScan1.Image := 'c:\xxx.tif';
  ImgScan1.FileType := 1;
  ImgScan1.CompressionType := 3;

  ImgScan1.StartScan;
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360186
Hehe, I just found a very strange thing: it works well with D2, but not with D3!!!

So I move to D2...

BIG THANKS!
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360187
Ooops! -the points!

Kind regards,
Matvey
0
 
LVL 1

Expert Comment

by:Odie
ID: 1360188
Just to tell you it works on my Delphi 3.

Odie
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360189
Odie, I think you can help me once again. Can I ask for your email please?
0
 
LVL 3

Author Comment

by:Matvey
ID: 1360190
Odie, I think you can help me once again. Can I ask for your email please?

bosism@netvision.net.il
0
 
LVL 1

Expert Comment

by:Odie
ID: 1360191
smathsoft@geocities.com

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now