Re: how to script resizing in Graphic Converter
Re: how to script resizing in Graphic Converter
- Subject: Re: how to script resizing in Graphic Converter
- From: Tim Clark <email@hidden>
- Date: Fri, 06 Jul 2001 10:31:24 -0400
>
--- Simon Forster wrote:
>
I have a script which uses GraphicConverter to open up an image, resize it,
>
etc.
>
--- end of quote ---
>
>
Simon,
>
>
Would you please share the script that you use to resize an image? I looked in
>
the GraphicConverter dictionary and saw only a scale command. What I need is a
>
resize to make my thumbnails all 110 pixels wide. Can you help with this?
I pulled this from a HUGE AppleScript that I wrote for a FileMaker DB, and a
lot of the other bits relied on FM data and stuff from external scriptfiles
(destination folders and so on.) If anyone wants a copy of the whole
shebang, along with annotations, I might be convinced to share.
This fragment will allow you to set the max width of the larger dimension of
an image to 110 px. As it stands it will work on the original image, but if
you add statements to copy the image to a new location, and work on the
copy, it should work out for you.
Also, because the image dimensions will not always divide evenly by 110, you
may come out a pixel short or long.
--begin AS sample fragment--
set Max_Dim to "110" as integer
tell application "GraphicConverter"
activate
--Tweak the next line as needed
open TheFileToThumnail
--end tweak
set dim_list to image dimension of window 1
set Horiz_Dim to item 1 of dim_list
set Vert_Dim to item 2 of dim_list
end tell
if Vert_Dim > Horiz_Dim then
set factory to (Max_Dim / Vert_Dim)
else
set factory to (Max_Dim / Horiz_Dim)
end if
tell application "GraphicConverter"
scale window 1 horizontal factory vertical factory
save window 1 as JPEG
close window 1
end tell
--end AS fragment---