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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Saving files from a feeder scan

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Tod Posted - Feb 29 2012 : 14:21:41
Hi,

Do you have an example of the proper way to save out the images created from a twain feeder scan? My guess is that one must do it in either the OnAquireBitmap or OnAfterAquireBitmap event. I'd like to save the images out as JPGs as soon as they are scanned through the feeder. None of the examples save the files.

Thanks
4   L A T E S T    R E P L I E S    (Newest First)
Tod Posted - Feb 29 2012 : 15:21:05
Absolutely perfect :-)

Thanks Fabrizio
fab Posted - Feb 29 2012 : 14:58:50
ImageFileName[] is useful to display images stored in existing files, so, yes you have to save them and then call FillFromDirectory (or set ImageFileName[] manually).

Of course you can still set ImageFileName inside OnAcquireBitmap:

procedure TForm1.ButtonClick(Sender: TObject);
begin
  ImageEnMView1.MIO.OnAcquireBitmap := AcquireBitmap;
  ImageEnMView1.MIO.SelectAcquireSource();
  ImageEnMView1.MIO.Acquire();
end;

procedure TForm1.AcquireBitmap(Sender: TObject; ABitmap: TIEBitmap; var Handled: boolean);
var
  idx:integer;
  filename:string;
begin
  idx := ImageEnMView1.AppendImage();
  filename := Format('c:\page%d.jpg', [idx]);
  ABitmap.Write(filename);
  ImageEnMView1.ImageFileName[idx] := filename;
  Handled := true;
end;
Tod Posted - Feb 29 2012 : 14:49:03
Perfect,

My guess is that this won't update the ImageFilename[] property for each image. Would it be proper to just call a FillFromDirectory after the scan to populate these values?

Thanks
fab Posted - Feb 29 2012 : 14:42:13
Hi,
there are two ways.
1) the obvious way using TImageEnMView: acquire using Acquire then save using ImageEnmView.MIO.SaveToFile()
Of course you can still save each page as a separated jpeg, using ImageEnMView.GetImageToFile()

2) using an TImageEnMIO (without TImageEnMView) and handling OnAcquireBitmap. Example:

var
  mio:TImageEnMIO;
begin
  mio := TImageEnMIO.Create(nil);
  try
    mio.OnAcquireBitmap := AcquireBitmap;
    mio.SelectAcquireSource();
    mio.Acquire();
  finally
    mio.Free();
  end;
end;

var idx:integer = 0;

procedure TForm1.AcquireBitmap(Sender: TObject; ABitmap: TIEBitmap; var Handled: boolean);
begin
  ABitmap.Write(Format('c:\page%d.jpg', [idx]));
  inc(idx);
  Handled := true;
end;