Page 1 of 1

Restoring the size of a image object.

Posted: Sat Mar 20, 2021 4:53 pm
by Fermin
On an 'image object': Is there a direct way -a property or anything- to reset to the original image size (width and height) after enlarging or reducing it?
The only way I have found is to reload the image again (image’s fileName property).
Thanks in advance.

Re: Restoring the size of a image object.

Posted: Sat Mar 20, 2021 5:07 pm
by richmond62
The 'sensible' thing to do is store an image's original dimensions somewhere permanent
before resizing it.
-
SShot 2021-03-20 at 18.05.59.jpg

Re: Restoring the size of a image object.

Posted: Sat Mar 20, 2021 5:38 pm
by jmburnod
Hi Fermin,
You may use formattedWidth and formattedHeight.
Something like this:

Code: Select all

...
   lock screen
   put the loc of img 1 into tLoc
   set the width of img 1 to (the formattedWidth of img 1)   
   set the height of img 1 to (the formattedheight of img 1) 
   set the loc of img 1 to tLoc
...
Best regards
Jean-Marc

Re: Restoring the size of a image object.

Posted: Sat Mar 20, 2021 5:58 pm
by Fermin
Great, I had used formattedWidth for text fields but I hadn't thought of using it for images. Thank you very much...