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
 TImageEnMView multi scan and save to database
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

96 Posts

Posted - Jan 15 2021 :  21:14:28  Show Profile  Reply
Hi:
I want to use TImageEnMView to scan multiple pages and store them in the data,and my code:

DBBitmap: TIEDBBitmap;
DBMultiBitmap: TIEDBMultiBitmap;

form create:
  DBMultiBitmap := TIEDBMultiBitmap.Create(dsImages, 'Image', 'FileName');
  DBMultiBitmap.Mode := dmAllRecords;
  ImageEnMView.SetExternalMBitmap(DBMultiBitmap);
  DBMultiBitmap.FollowDBCursor := True;

  DBBitmap := TIEDBBitmap.Create(dsImages, 'Image', 'FileName');
  imageenview.SetExternalBitmap(DBBitmap);


procedure TFrmScan.ImageEnMViewAcquireBitmap(Sender: TObject;
  ABitmap: TIEBitmap; DpiX, DpiY: Integer; var Handled: Boolean);
begin
  ABitmap.Rotate(180);
  DBMultiBitmap.AppendImage(ABitmap);
end;

After the scan, there are a lot of blank data stored in the database.

xequte

38610 Posts

Posted - Jan 15 2021 :  21:55:50  Show Profile  Reply
Hi

Is the content of ABitmap valid prior to the append?

When do you see the blank content? Immediately in the TImageEnMView after the scan? Or only in the database content itself?


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

Flashcqxg

96 Posts

Posted - Jan 15 2021 :  22:05:19  Show Profile  Reply
Hi
I use double-sided scanning. When scanning, TImageEnMView will first display two identical pictures (but in fact the front and back contents are different), but a blank picture will be displayed later. In the final data, there are correct data, but there will also be the same number of blank data rows.
Go to Top of Page

xequte

38610 Posts

Posted - Jan 15 2021 :  22:31:01  Show Profile  Reply
So, it sounds like the image is not being written correctly to the database. Does it need to be manually flushed? What database engine do you use?



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

Flashcqxg

96 Posts

Posted - Jan 15 2021 :  22:33:38  Show Profile  Reply
I use the firedac+sqlite,use the default attributes of fdquery.
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jan 15 2021 :  22:36:29  Show Profile  Reply
I scanned 2 pages of paper with 4 pictures on both sides. There are 4 correct picture rows in the database and 4 blank rows.
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jan 15 2021 :  22:41:58  Show Profile  Reply
Logger.Info(DBMultiBitmap.AppendImage(ABitmap).ToString);
The log:

[2021-01-16 11:40:07] INFO 0
[2021-01-16 11:40:15] INFO 2
[2021-01-16 11:40:21] INFO 4
[2021-01-16 11:40:27] INFO 6
Go to Top of Page

xequte

38610 Posts

Posted - Jan 16 2021 :  18:15:40  Show Profile  Reply
Hmmm, I can't see any good reason for this occurrence.

Does the following code also do a double append?

ABitmap := TBitmap.create;
ABitmap.Read( 'C:\image.jpg' );
DBMultiBitmap.AppendImage(ABitmap);
ABitmap.Free;


How about if you use non-ImageEn methods for appending?

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

Flashcqxg

96 Posts

Posted - Jan 16 2021 :  19:19:50  Show Profile  Reply
Hi,i have test the code,it works well.
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jan 16 2021 :  19:22:24  Show Profile  Reply
Now i use the TBlobField method to add directly to the database.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: