Solved

Using a scanner

Posted on 1998-03-05
26
336 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
creating manifest for my dll that called from activex 6 114
Delphi application Soap connection 5 103
Delphi XE10 Round Image 2 128
Base1 Encode/Decode 3 77
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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