[TIP] Quick & Dirty Image Resizing

Ken Ray kray at sonsothunder.com
Sat Jan 26 03:02:19 EST 2013

On Jan 25, 2013, at 4:07 PM, Scott Rossi <scott at tactilemedia.com> wrote:

> For Friday, I thought I'd share a small script/setup that's quite handy for
> manually resizing/positioning images when you're laying out a stack.
> The Setup:
> 1) Import your image, set its resizeQuality to "good", lock it, group it,
> and set the margins of the group to 0.
> 2) Create a button somewhere in the stack (or substack) to serve as a
> behavior, name it "Image Box Lib" or similar, and give it this script:
> on resizeControl
>   put long id of img 1 of me into myImage
>   put formattedHeight of myImage/formattedWidth of myImage into thePercent
>   set resizeQuality of myImage to "good" -- OPTIONAL
>   set rect of myImage to left of me,top of me,right of me,top of me +
> round(width of me * thePercent)
> end resizeControl
> 3) Set the behavior of the group to the long id of the button.
> Now select the image group and drag the right, left, or bottom right/left
> corners, and the image should proportionally resize. It should maintain
> decent quality, it will maintain its size because it's locked, and even
> though it's locked, you can drag-relocate it on the card because it's
> contained by an unlocked group.  If you need better quality, change the
> "good" option to "best", though resizing will occur a bit slower.

Nice! That's a quick and simple way to doing what I've been doing for a while now, but with a longer and more convoluted approach.

Thanks, Scott!

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	

More information about the Use-livecode mailing list