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
 Enforce Width and Height on ImageIOAcquireBitmap
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Josir

Brazil
12 Posts

Posted - Nov 18 2015 :  15:34:22  Show Profile  Reply
Hi folks,

I have an application that uses several scanner devices. On some of them, the Width and Height is not set properly.

How can I enforce the Width/Height bitmap size before or after acquire the image ?

procedure TfrmMain.ImageIOAcquireBitmap(Sender: TObject;
  ABitmap: TIEBitmap; var Handled: Boolean);
var NomeArquivo:String;
begin
  NomeArquivo := EditDest.Text + Filename + '_' + StrZero(Counter,4)+'.tif';
  ImageIO.AttachedIEBitmap := ABitmap;
  ImageIO.AttachedIEBitmap.PixelFormat := ie1g;
  if Debug then
    with ImageIO.AttachedIEBitmap do
    begin
      Height := 3507;
      Width := 2496;
      ShowMensagem('Attached Height:'+IntToStr(Height));
      ShowMensagem('Attached Width:'+IntToStr(Width));
    end;

xequte

39053 Posts

Posted - Nov 18 2015 :  16:17:02  Show Profile  Reply
Hi

Sorry I don't see what you are trying to do here. Are you saying the ABitmap returned in ImageIOAcquireBitmap() has a height and width of zero?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Josir

Brazil
12 Posts

Posted - Nov 19 2015 :  04:03:35  Show Profile  Reply
Hi Nigel,

the image acquired has a size different from my need. I have to generate an image with 3507 x 2496 size.

I tried to force the height and width but this is not working.

Is there a way to ask a TWAIN scanner to generate an image of specific size ?

Or: Is there way to change the image size after acquire ?

Thanks for the support!
Go to Top of Page

xequte

39053 Posts

Posted - Nov 19 2015 :  17:05:55  Show Profile  Reply
Hi

Sorry, I've got you now. The scanner does give you some contol over acquisition size, but it sounds like you'd be better to resize it after acquisition:

aIEBitmap.Resample( 3507, 2496, rfFastLinear, True );

More Info:

http://www.imageen.com/help/TIEBitmap.Resample.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Josir

Brazil
12 Posts

Posted - Nov 23 2015 :  10:50:13  Show Profile  Reply
Hi Nigel,

I think the version I use do not have yet the Resample method :(

I´m still using 4.0 version (I bought it in 2011).

Is there any workaround ?

Thanks in advance,
Josir.


Go to Top of Page

w2m

USA
1990 Posts

Posted - Nov 23 2015 :  11:01:52  Show Profile  Reply
Try using TImageEnProc to resample:
procedure TfrmMain.ImageIOAcquireBitmap(Sender: TObject;
  ABitmap: TIEBitmap; var Handled: Boolean);
var
NomeArquivo:String;
iImageEnProc: TImageEnProc;
begin
  NomeArquivo := EditDest.Text + Filename + '_' + StrZero(Counter,4)+'.tif';
  try
  iImageEnProc := TImageEnProc.Create(nil);
  iImageEnProc.AttachedIEBitmap := ABitmap;
  iImageEnProc.Resample(3507, 2496, rfFastLinear, True);
  if Debug then
    with iImageEnProc.AttachedBitmap do
    begin
      ShowMensagem('Attached Height:'+IntToStr(Height));
      ShowMensagem('Attached Width:'+IntToStr(Width));
    end;
  finally
    iImageEnProc.Free;
   end;
end;

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

Josir

Brazil
12 Posts

Posted - Nov 27 2015 :  10:32:22  Show Profile  Reply
Hi Bill. It works perfectly!

I have just to add unit hyieutils on Uses clause.

Thanks a lot!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: