Graphics32 Fit Image lazarus / 39-Graphics ---------------------------------------------------------------------- Pe3s · 2022-08-31 18:51 Hello, how can I check if an image is in Portrait or Landscape format and adjust it to display? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button2Click(Sender: TObject);var  Fit: Single;begin    Fit := ImgView32_1.Height / ImgView32_1.Bitmap.Height;  ImgView32_1.Scale := Fit;end; Width code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Fit := ImgView32_1.Width / ImgView32_1.Bitmap.Width;  How to connect together? ---------------------------------------------------------------------- paweld · 2022-08-31 19:06 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button2Click(Sender: TObject); var   Fit: Single; begin    if ImgView32_1.Bitmap.Height > ImgView32_1.Bitmap.Width then     ShowMessage('Portrait')   else     ShowMessage('Landscape');    Fit := ImgView32_1.Height / ImgView32_1.Bitmap.Height;   if Fit > ImgView32_1.Width / ImgView32_1.Bitmap.Width then        Fit := ImgView32_1.Width / ImgView32_1.Bitmap.Width; end; You can also set ScaleMode to smOptimal or smStretch and then the size will be automatically adjusted: https://graphics32.github.io/Docs/Units/GR32_I mage/Classes/TCustomImage32/Properties/ScaleMode.htm ---------------------------------------------------------------------- Pe3s · 2022-08-31 19:37 Thank you, you cannot zoom with those options