ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Discard blank pages and save JPG while scanning
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

LeoFong

Hong Kong
4 Posts

Posted - Jan 30 2019 :  01:46:59  Show Profile  Reply
Hello everybody.

I use ImageEnMView to acquire sequential images from Koda3000(more than 200 pages).

(1) I would like to discard the blank pages.

ImageEnMView1.MIO.TwainParams.AutoDiscardBlankPages := -1;
ImageEnmView1.mIO.TwainParams.Update;
ImageEnMView1.MIO.Acquire;

No matter what I changed the value, -1, -2 , 0, 60,000 or 200,000, the blank pages are still there.

(2) How can i save the pages into individual JPG file while scanning? Now i can only do it by this way but have to keep waiting till scanning finished (3 mins).

For i:=0 to ImageEnMView1.MIO.IEMBitmap.Count-1 do
begin
ImageEnMView1.MIO.Params[i].JPEG_Quality := 50;
ImageEnMView1.GetImageToFile(i, 'C:\twain\p'+inttostr(i)+'.jpg');
end;

I tried below on the event of OnImageadd, OnImageadded,OnImageloaded in order to save the file once per page being scanned, but nothing happened. If put in Onimagecreated, 'Access violation at address xxxxxxxxx ' error occured.
ImageEnMView1.Mio.Params[idx].JPEG_Quality := 50;
ImageEnMView1.GetImageToFile(idx, 'C:\twain\p'+inttostr(idx)+'.jpg');


Tks.

xequte

38610 Posts

Posted - Jan 30 2019 :  04:28:21  Show Profile  Reply
Hi

1. Are you sure you are using Twain acquisition and not something else, like WIA?

2. You can save each image after acquisition in the OnAcquireBitmap event.

https://www.imageen.com/help/TImageEnMView.OnAcquireBitmap.html

e.g. ABitmap.Write('D:\..');


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

LeoFong

Hong Kong
4 Posts

Posted - Jan 30 2019 :  10:21:28  Show Profile  Reply
Nigel, thanks for you reply.

(1) I am sure the aquisition source must be TWAIN. And the scanner supports 'Discard blank pages' since this function could be done in KODAK SVT(scanning software).

(2) I tried 'ABitmap.Write('xxx.jpg')' in the OnAcquireBitmap event, it worked. One more question, is there any way to control the quality of JPG? Like 'JPEG_Quality := 50'.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 30 2019 :  10:57:49  Show Profile  Reply
You could use:

ABitmap.ParamsEnabled := True;
ABitmap.Params.JPEG_Quality := 100;
ABitmap.Write('test.jpg');

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

LeoFong

Hong Kong
4 Posts

Posted - Jan 30 2019 :  11:15:08  Show Profile  Reply
@Bill

Yes, it works! Thanks. Now my only problem is how to discard blank pages.
Go to Top of Page

xequte

38610 Posts

Posted - Jan 30 2019 :  18:18:20  Show Profile  Reply
Hi

I'm not sure what to suggest regarding AutoDiscardBlankPages. ImageEn just passes the value to the Twain driver to handle. Pethaps the Kodak software does it differently, e.g. in code.

You can do it in code too using:

https://www.imageen.com/help/TImageEnMView.RemoveBlankPages.html


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: