TImage Picture actual dimensions?

I have an Image where the stretch and Proportional properties are set to true. I want to get the actual displayed width and height of the picture for this image. Are there properties I can access directly to get these values or do I need to calculate them manually based on the Image height and width and original picture height and width. The Image1->Picture->Width and Image1->Picture->Height properties are that of the original image, not the stretched/displayed image.


  • Image->Width and Image->Height are the Image dimensions as shown on the screen. Note (and I guess you noticed) that these do not work in the TForm constructor, because then the Image is not yet visible.

    See ya, Bilderbikkel
  • Image->Width/Height variables are the width and height of frame for the image not necessarily the width and height of the actual displayed picture. If Autosize and proportional properties are set to true then one of the picture dimensions will be the same as the Image frame (the larger one) but the other may not, as the ratio of the picture is kept the same as the original when resizing.

    What I want to know is if there is an easy way of accessing both picture dimensions (width and height) after the picture has been resized to fit in the Image frame. Otherwise they can be calculated.

  • I am working on an application with similar problem to yourself. Even using the 'stretch' property of TImage can make the displayed image nosensical in terms of whether its Landscape or Portrait. I am toying with the idea of using an API function to get the 'dimension attributes' of the pre-loaded image, then resizing TImage proportions correctly before loading the image.

    As yet I have not had the time to solve this conundrum and as such I can only offer this suggestion.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!