Retaining image size after being resized

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Pebah
Posts: 23
Joined: Mon Aug 01, 2011 9:35 pm

Retaining image size after being resized

Post by Pebah » Thu Aug 18, 2011 11:24 pm

I'm scripting the resizing of an image by setting the image width and height.

I use the create command to make an image control, give the image a URL, set the resizeQuality parameter, set the height and width, and it looks perfect on the card. However, when I go to another card and then come back the image is back at it's original size (very large).

Is there something I'm missing that's not saving the new size? Is it possible?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Retaining image size after being resized

Post by Dixie » Thu Aug 18, 2011 11:41 pm

Pehab

lock the image after you have finished altering its height and width to your wishes...

Code: Select all

 set the lockLocation of image x to true
be well,

Dixie

Pebah
Posts: 23
Joined: Mon Aug 01, 2011 9:35 pm

Re: Retaining image size after being resized

Post by Pebah » Thu Aug 18, 2011 11:56 pm

Dixie wrote:Pehab

lock the image after you have finished altering its height and width to your wishes...

Code: Select all

 set the lockLocation of image x to true
be well,

Dixie
That works, thanks!

Now, is the image part of the stack now, or is it just reading it off of the disk again. The latter seems true. I want it to be the former. I'm making a stack that is a collection of images for other uses elsewhere in the project.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Retaining image size after being resized

Post by Dixie » Fri Aug 19, 2011 12:07 am

Pebah..

Look at 'import' command in the dictionary...it allows you to create an image, amongst other things, and copy the contents of the file into the object.

be well

Dixie

Pebah
Posts: 23
Joined: Mon Aug 01, 2011 9:35 pm

Re: Retaining image size after being resized

Post by Pebah » Fri Aug 19, 2011 12:14 am

Thanks for that.

I'm reading now that I really shouldn't be importing the images to minimize memory use.

Is there a way to save the resized images back to disk? The save command seems to only refer to saving the stack.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Retaining image size after being resized

Post by Dixie » Fri Aug 19, 2011 12:18 am

Pebah...

Now you are making me smile... :) Have a look at the 'Export' command in the dictionary. You will be able to then put the file wherever you want to...

be well

Dixie

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Retaining image size after being resized

Post by Dixie » Fri Aug 19, 2011 12:58 am

Pehab...

Attached a stack... the folder contains the stack and an image file, click the import button and then the export button... the exported file will be saved to the folder... look at the stack script as well as the button scripts...

hope it helps...

Dixie
Attachments
InAndOut.zip
(20.56 KiB) Downloaded 236 times

Post Reply