[TIP] Quick & Dirty Image Resizing

Scott Rossi scott at tactilemedia.com
Fri Jan 25 17:07:37 EST 2013


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.

Have fun.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design





More information about the use-livecode mailing list