[TIP] Quick & Dirty Image Resizing

Hakan at Exformedia.se Hakan at Exformedia.se
Mon Jan 28 04:09:32 EST 2013


I have something similar, but also have the shiftKey in the script, your script would be
on resizeControl
   if the shiftKey is down then
      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)
   else
      set the rect of img 1 of me to the rect of me
   end if
end resizeControl

Then you can scale proportionally if you hold the shift key down and not proportionally if you don't as is common in other applications.

:-Håkan
	
25 jan 2013 kl. 23:07 skrev Scott Rossi <scott at tactilemedia.com>:

> 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
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list