[TIP] Quick & Dirty Image Resizing

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[TIP] Quick & Dirty Image Resizing

ScottR
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: [TIP] Quick & Dirty Image Resizing

Ken Ray

On Jan 25, 2013, at 4:07 PM, Scott Rossi <[hidden email]> 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: [hidden email]
Web Site: http://www.sonsothunder.com/       

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: [TIP] Quick & Dirty Image Resizing

mwieder
In reply to this post by ScottR
Scott-

Friday, January 25, 2013, 2:07:37 PM, you 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.

Nice. Thanks. I can put this to use right away.

--
-Mark Wieder
 [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: [TIP] Quick & Dirty Image Resizing

Hakan@Exformedia.se
In reply to this post by ScottR
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 <[hidden email]>:

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


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode