Solved

Using a scanner

Posted on 1998-03-05
26
342 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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