new altResizeImage Library available
Chipp Walters
chipp at chipp.com
Wed Jul 7 17:26:39 EDT 2004
I've recently finished a new library control which allows you to resize
and save images in different file formats. It's all in transcript and
can be found at the bottom of page:
http://www.altuit.com/webs/altuit2/RunRev/Downloads.htm
It uses the little known bilinear interpolation algorithm built into
RunRev-- property called 'resizeQuality', to create a very nice resized
image.
You could use this control for instance to build a program that
automatically made thumbnail files for a folder full of images, or to
convert PNG's into JPEGS. I've tested in only on WinXP for now. If you
find a problem, please email me offlist.
best,
Chipp
From the website:
----------------------------------------------
altResizeImgLib
by Chipp Walters, Altuit, inc.
This library allows you to resize and save an image with the 'best'
resizeQuality of the engine while maintaining the aspect ratio. It can
save in PNG, JPEG or GIF formats (if you have purchased the GIF unlock
code from RR).
This DEMO stack
Press the Resize Image button and you are prompted for an image to open.
Then you are asked for a filename to save as. Next, the altResizeImage
command is called with the parameters specified by Maximum
Height/Maximum Width and the pixel value.
If you set the control to Maximize Height, then the image height will be
set to the height value specified with the width being whatever it needs
to be to maintain proportions. If you set the control to Maximize Width,
then the image width will be set to the width value specified with the
height being whatever it needs to be to maintain proportions.
You can press the Open Viewer button to browse for and view the newly
resized image.
How to install
Make the stack "altResizeImg" as a substack of your main stack.
Then use the commands:
start using stack "altResizeImgLib"
altResizeImage tFilePath,tFilePathToSave,tSize,tMode,tJpgQual
stop using stack "altResizeImgLib"
Where:
tFilePath IS THE ORIGINATING IMAGE FILEPATH
tFilePathToSave IS THE DESTINATION FILEPATH
NOTE: THIS HANDLER WILL LOOK AT THE EXTENSION OF THE FILE IN
tFilePathToSave TO DETERMINE WHAT FILE TYPE TO SAVE AS. IF NO EXTENSION
THEN DEFAULT IS "JPEG"
tSize IS THE MAXWIDTH OR MAXHEIGHT IN PIXELS. ALL IMAGES ARE RESIZED
PROPORTIONALLY
tMode IS EITHER "MaxHeight" or "MaxWidth" AND TELL THE HANDLER WHICH ONE
TO OPTIMIZE
tJpgQual IS OPTIONAL AND TELLS WHAT JPEGQUALITY TO SAVE AS. DEFAULT IS 90
More information about the use-livecode
mailing list