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
 Problems understanding IO.Params.DPI
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

uko

Germany
31 Posts

Posted - May 09 2017 :  09:12:57  Show Profile  Reply
Hi

I have some troubles understanding the results of IO.Params.DPI: depending on the way I read this params I get different results for the same image (ImageEN version 6.3.2 using Delphi XE).

Please take this picture:


I used this test code to read the DPI
ImageEnView1.IO.LoadFromFileAuto('d:\downloads\elefant.jpg');

  lIO := TImageEnIO.Create(nil);
  try
    lIO.LoadFromFileAuto('d:\downloads\elefant.jpg');
    nDPI_lIO := lIO.Params.Dpi;
  finally
    lIO.Free;
  end;

  lIO := TImageEnIO.Create(nil);
  try
    lIO.ParamsFromFile('d:\downloads\elefant.jpg');
    nDPI_lIO_pre := lIO.Params.Dpi;
  finally
    lIO.Free;
  end;

  ShowMessage(Format('lIO.Params.Dpi: %d' + #10#13 + 'lIO.Params.Dpi (ParamsfromFile): %d' + #10#13 + 'ImageEnView1.IO.Params.Dpi: %d',[nDPI_lIO, nDPI_lIO_pre, ImageEnView1.IO.Params.Dpi]));


The results are 300, 1 and 300. So why I get a different result when using ParamsFromFile? And what does this values mean in the current situation? I checked the image with IrfanView and it looks like there is no resolution assigned.
So how can I determine if there is a resolution assigned?


Thank you,
Uli

xequte

38611 Posts

Posted - May 09 2017 :  23:15:42  Show Profile  Reply
Hi Uli

This image has an invalid DPI specified (1), so when it is loaded as an image, ImageEn corrects it with the default DPI (specified in iesettings).

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

uko

Germany
31 Posts

Posted - May 15 2017 :  08:12:49  Show Profile  Reply
Hi Nigel,

please excuse the long delay in answering. And thank you for explaining the problem. My solution is now, to adjust the default DPI to 72DPI (which fit's much better for me) and always do a check like TImageEnIO.CheckDPI when loading the params independent from image. One wish: can you make TImageEnIO.CheckDPI a public method?

Thank's Uli
Go to Top of Page

xequte

38611 Posts

Posted - May 16 2017 :  02:04:39  Show Profile  Reply
Hi Uli

You can just check the DPI yourself after loading and set it correctly, if needed.

The default DPI settings are here:

https://www.imageen.com/help/TIEImageEnGlobalSettings.DefaultDPIX.html
https://www.imageen.com/help/TIEImageEnGlobalSettings.DefaultDPIY.html

e.g.

// Set the default DPI to 72 points per inch
IEGlobalSettings().DefaultDPIX:= 72;
IEGlobalSettings().DefaultDPIY:= 72;


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

uko

Germany
31 Posts

Posted - May 16 2017 :  02:38:43  Show Profile  Reply
Thanks Nigel.

I have done this now and everything is working fine.


best regards,
Uli
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: