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
 OnAcquireBitmap
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Dany

67 Posts

Posted - Jul 18 2018 :  11:32:51  Show Profile  Reply
Hello;

I am trying to optimize bitmaps that are comming form scanner. For example, I did this with success:

procedure TImgCollection.ImgNavigateAcquireBitmap(Sender: TObject;
  ABitmap: TIEBitmap; DpiX, DpiY: Integer; var Handled: Boolean);
begin
  ABitmap.Resample(1000, 1000, rfFastLinear, True, True);
end;


Is it possible to change the Bitmap DPI in this event?

For example I tried using:

procedure TImgCollection.ImgNavigateAcquireBitmap(Sender: TObject;
  ABitmap: TIEBitmap; DpiX, DpiY: Integer; var Handled: Boolean);
begin
  ABitmap.ParamsEnabled := True;
  ABitmap.Params.Dpi := 72;
end;

... but it does not changing the file size.

Thank you!

xequte

39061 Posts

Posted - Jul 19 2018 :  02:07:54  Show Profile  Reply
Hi Dany

Firstly, it is not recommended to use ParamsEnabled, except for stand-alone bitmap objects. In this case it is bitmap of TImageEnMView, so you should use TImageEnMView.MIO.Params[].

Secondly, you can change the resolution (size and DPI) of an image using TImageEnView.ChangeResolution:

https://www.imageen.com/help/TImageEnView.ChangeResolution.html

But I am not a big fan of that. DPI should be thought of only as instruction on the size to print an image, so changing the size of an image to get a desired DPI is going to reduce its quality.



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

Dany

67 Posts

Posted - Jul 19 2018 :  07:31:48  Show Profile  Reply
Hi Nigel;

Thank you!. Ok, I understand. It will be enough for me if I can set DPI at the time I save from a TImageEnMView collection to a PDF (without changind the DPI on the collection) but I can't find how. For example, I want the whole PDF at 72 DPI. Can you give me any clue?.
Go to Top of Page

Dany

67 Posts

Posted - Jul 19 2018 :  09:33:24  Show Profile  Reply
BTW ... CHANGERESOLUTION is very well I guess, but I don't see where I have this methog available under OnAcquireBitmap, or even under the TImageEnMView collection.
Go to Top of Page

xequte

39061 Posts

Posted - Jul 20 2018 :  20:38:00  Show Profile  Reply
To set the DPI (without changing size) you can use:

// Change the DPI of all images
for I := 0 to ImageEnMView1.MIO.ParamsCount - 1 do
begin
ImageEnMView1.MIO.Params[ I ].DpiX := 72;
ImageEnMView1.MIO.Params[ I ].DpiY := 72;
end;

If desired, you can also change the size of all images using

ImageEnMView1.IEMBitmap.ResampleAll()

https://www.imageen.com/help/TIEMultiBitmap.ResampleAll.html

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