Link to home
Start Free TrialLog in
Avatar of Matvey
Matvey

asked on

Using a scanner

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
Avatar of inter
inter
Flag of Türkiye image

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
Avatar of ZifNab
ZifNab

Yo Matvey,

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

Regards, Zif.
Yo Matvey,

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

Regards, Zif.
Avatar of Matvey

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Odie
Odie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Matvey

ASKER

Odie, what do you mean any new Win. ver? Where exactly I can find this OCX?

Thanks!!!
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
Avatar of Matvey

ASKER

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!
Yo Matvey, that TWAIN thing is a DLL file...
Avatar of Matvey

ASKER

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

Can you help?
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.
Avatar of Matvey

ASKER

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
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!
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');

Avatar of Matvey

ASKER

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)
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.
Avatar of Matvey

ASKER

FileType for the ImgScan? -let's try...
Avatar of Matvey

ASKER

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!
OK I'll check (note: I tested it with C++Builder).
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;
Avatar of Matvey

ASKER

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

So I move to D2...

BIG THANKS!
Avatar of Matvey

ASKER

Ooops! -the points!

Kind regards,
Matvey
Just to tell you it works on my Delphi 3.

Odie
Avatar of Matvey

ASKER

Odie, I think you can help me once again. Can I ask for your email please?
Avatar of Matvey

ASKER

Odie, I think you can help me once again. Can I ask for your email please?

bosism@netvision.net.il
smathsoft@geocities.com