Restoring the size of a image object.

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

Restoring the size of a image object.

Post by Fermin » Sat Mar 20, 2021 4:53 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Restoring the size of a image object.

Post by richmond62 » Sat Mar 20, 2021 5:07 pm

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
Attachments
PC RESIZER.livecode.zip
Unfinished stack.
(29.63 KiB) Downloaded 194 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Restoring the size of a image object.

Post by jmburnod » Sat Mar 20, 2021 5:38 pm

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
https://alternatic.ch

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

Re: Restoring the size of a image object.

Post by Fermin » Sat Mar 20, 2021 5:58 pm

Great, I had used formattedWidth for text fields but I hadn't thought of using it for images. Thank you very much...

Post Reply

Return to “Mac OS”