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
 Wrong image width and height in pixel
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

mastinf

Italy
46 Posts

Posted - Mar 04 2025 :  11:27:03  Show Profile  Reply
Hello, i have this old code that read the height e width of an image in pixel.
I have recently upgraded to the latest version of ImageEn an now the function returns the wrong image size: width and height are swapped. I have attached an image. Thanks.

var
  img:Timageenview;
  ff: TIOFileType;
begin
  if not(fileexists(percorso_immagine)) then exit;

  img:=Timageenview.create(nil);
  try
    ff := FindFileFormat( percorso_immagine, false );
    img.IO.ParamsFromFile( percorso_immagine, ff );

    puntix:=img.io.params.width;
    puntiy:=img.io.params.height;
  finally
    img.free;
  end;
end;


attach/mastinf/202534112337_AU-ART1.JPG

Roberto Nicchi
Master Informatica
Italy

mastinf

Italy
46 Posts

Posted - Mar 05 2025 :  02:45:32  Show Profile  Reply
Ok, i got it. It's related to the io.params.exif_orientation. The image is rotate 90°

Roberto Nicchi
Master Informatica
Italy
Go to Top of Page

xequte

38875 Posts

Posted - Mar 05 2025 :  21:23:08  Show Profile  Reply
Hi Roberto

Yes, that's right. Also, you can control the automatic rotation using:

http://www.imageen.com/help/TIOParams.EnableAdjustOrientation.html

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

mastinf

Italy
46 Posts

Posted - Mar 06 2025 :  02:11:06  Show Profile  Reply
Hello, EnableAdjustOrientation seems to have no effect. Setting true or false doesn't change the width and height.

img.IO.Params.EnableAdjustOrientation:=true/false
img.IO.ParamsFromFile( ... );

puntix:=img.io.params.width; <---- doesn't change
puntiy:=img.io.params.height; <---- doesn't change

Roberto Nicchi
Master Informatica
Italy
Go to Top of Page

mastinf

Italy
46 Posts

Posted - Mar 06 2025 :  02:45:32  Show Profile  Reply
Could be normal that EnableAdjustOrientation doesn't affects io.params.width and height.
If it's correct does exists a function to calculate the correct width and height of the image depending on EXIF_ORIENTATION ? Or have to write my own ? Thanks.

Roberto Nicchi
Master Informatica
Italy
Go to Top of Page

xequte

38875 Posts

Posted - Mar 06 2025 :  16:13:28  Show Profile  Reply
Hi Roberto

Sorry, I confused matters with my comment. EnableAdjustOrientation only affects the display of the image on load, so ImageEnView1.IEBitmap.Width/Height are affected by EnableAdjustOrientation, but not ImageEnView1.IO.Params.Width/Height (which show the true values).


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

mastinf

Italy
46 Posts

Posted - Mar 13 2025 :  06:29:03  Show Profile  Reply
Does exists a function that calculate the width and height depending on EXIF_ORIENTATION ?

Thanks.

Roberto Nicchi
Master Informatica
Italy
Go to Top of Page

xequte

38875 Posts

Posted - Mar 13 2025 :  16:12:12  Show Profile  Reply
Hi Roberto

Not at present, but you can just swap the values as follows:

    if Params.EXIF_Orientation in [ _exoNeeds90RotateCW, _exoNeeds270RotateCW ] then
      Swap( Width, Height );


Or email me for the latest beta, which supports it with:

https://www.imageen.com/help/GetImageDetails.html

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