• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to make thumbnail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to make thumbnail


  • Subject: Re: How to make thumbnail
  • From: Gary Lists <email@hidden>
  • Date: Thu, 26 Feb 2004 04:36:23 -0500

Walter Ian Kaye wrote [2/26/04 1:08 AM]:

> At 10:10a -0500 02/25/2004, SAC maison didst inscribe upon an
> electronic papyrus:
>
>> I need to make thumbnail from a lot of images. Is there a way to do it with
>> AppleScript and a Srcipting Addition? If yes, is there a way to define the
>> bound of the thumbnail? Example 80 X 80 or 120 x 120
>
> Are you gonna tell us what OS version this would be for?
> The assumption is "latest bleeding edge OS" unless otherwise specified.
> However, you are writing email from Mac OS, not OS X.

[

And one of us is not using the latest 'bleeding edge' Entourage for 9!

SAC House's says: User-Agent: Microsoft-Entourage/9.0.2509

Mine says: User-Agent: Microsoft-Entourage/9.0.2.4011

]

> Let us know...

Some options applicable to OS 9 and the stuff I have installed are:

<non-AS ways>

1. ImageReady can make droplets that will thumbnail every image into a
predefined size, color depth and format. No AS writing involved. Just make
the settings in the output window and drag the droplet icon to anywhere.

2. Clip2Gif is a handy little tool. It's prefs can be set to convert on open
(i.e., 'drop'). You can dictate scaling preferences and so forth. This
essentially makes the application a drop converter/thumbnailer, that acts
with the current prefs.

3. Use any kind of 'preview maker' (More File Info CM, Graphic Converter,
PhotoShop, ...) to give each file a preview (the kind that shows up in a
NavSvcs dialog). Then, set the Finder's window view to large icon.

4. Extend number 3 by using Icon2Gif or even IconToGif to make tiny
thumbnails (literally the size of a thumb nail! :)

<some AS ways>

5. Graphic Converter's dictionary is quite sufficient and the app's
shareware, if you like it, but free to download. It will require that GC
actually open each image (AFAICS). Also, I can't make 'scale' work, but I
can use 'image dimension' (a window property).

See below for a tested script that I just made. It's a bit limited (mainly
because of 'scale'...drats) because if you choose to make thumbs of specific
width/height then you'll squash the image, not scale it proportionally. It
does work well for Percentage reduction, in my 10 image test. Not terribly
slow, either, but not ideal.

6. PhotoScripter can also do it, if you're a kazillionaire and can afford
Adobe software.


--
Gary
...doesn't know what he's supposed to do about long lines here,
so he left them wrapped (sorry) ... it's the 'display dialog' lines


Okay, here's a GraphicConverter (4.4.4) script, tested in OS 9.

-- start

on run -- pick a single file (more for testing really)

set aFile to choose file

try
set thumbMethod to button returned of (display dialog "Scale by
PERCENTAGE or to SPECIFIC dimension (no scaling is done...can't get 'scale'
to work)?" buttons {"Cancel", "Percentage", "Specific"} default button
"Specific")

if thumbMethod is "Percentage" then

try
set pcentValue to text returned of (display dialog "Enter
the percentage value to scale both X and Y" default answer "50" buttons
{"Cancel", "OK"} default button "OK")
set xP to (pcentValue / 100)
set yP to (pcentValue / 100)

on error
return -- "cancel" and die
end try

else -- specific dimensions
try
set xDim to text returned of (display dialog "Enter the
WIDTH of the desired thumbnail." default answer "100" buttons {"Cancel",
"OK"} default button "OK")
set yDim to text returned of (display dialog "Enter the
HEIGHT of the desired thumbnail." default answer "50" buttons {"Cancel",
"OK"} default button "OK")


on error
return -- "cancel" and die
end try

end if

on error
-- cancel
return -- and die
end try

-- where to save thumbs
set outFolder to choose folder with prompt "Select or create a folder in
which to save the thumbnails."


tell application "GraphicConverter"

open (aFile as text)

tell window 1
set fName to name
set outName to (outFolder as text) & "t_" & fName
set {x, y} to image dimension
set {xO, yO} to {x, y} -- safeguard, same as original
-- I guess this is an okay way
-- to get the required integer value that GC wants for
-- 'image dimension'
if thumbMethod is "PERCENTAGE" then
set {xO, yO} to {(x * xP) div 1, (y * yP) div 1}
else -- its "SPECIFIC"
set {xO, yO} to {xDim, yDim}
end if

set it's image dimension to {xO, yO}

end tell -- w1
-- save window 1 in outName as GIF with makeCopy and wwwready
save window 1 in outName as GIF -- with makeCopy and wwwready
close window 1 without saving

end tell -- GC

end run

-- drop multiple files
on open theseItems -- accepts multiple files, not folders

try
set thumbMethod to button returned of (display dialog "Scale by
PERCENTAGE or to SPECIFIC dimension (no scaling is done...can't get 'scale'
to work)?" buttons {"Cancel", "Percentage", "Specific"} default button
"Specific")

if thumbMethod is "Percentage" then

try
set {pbtn, pcentValue} to {button returned, text returned}
of (display dialog "Enter the percentage value to scale both X and Y"
default answer "50" buttons {"Cancel", "OK"} default button "OK")
set xP to (pcentValue / 100)
set yP to (pcentValue / 100)

on error
return -- "cancel" and die
end try

else -- specific dimensions
try
set xDim to text returned of (display dialog "Enter the
WIDTH of the desired thumbnail." default answer "100" buttons {"Cancel",
"OK"} default button "OK")
set yDim to text returned of (display dialog "Enter the
HEIGHT of the desired thumbnail." default answer "50" buttons {"Cancel",
"OK"} default button "OK")
on error
return -- cancel and die
end try

end if

on error
return -- cancel and die
end try


-- where to save thumbs
set outFolder to choose folder with prompt ,
"Select or create a folder in which to save the thumbnails."

-- do the deal
tell application "GraphicConverter"

repeat with anItem in theseItems

open (anItem as text) -- weird GC...alias errors for me

tell window 1
set fName to name
set outName to (outFolder as text) & "t_" & fName
set {x, y} to image dimension
set {xO, yO} to {x, y} -- safeguard, same as original
-- now change it
if thumbMethod is "PERCENTAGE" then
set {xO, yO} to {(x * xP) div 1, (y * yP) div 1}
else -- its "SPECIFIC"
set {xO, yO} to {xDim, yDim}
end if
set it's image dimension to {xO, yO}
end tell -- w1

-- next line will save with no icon, no QT preview
-- save window 1 in outName as GIF with makeCopy and wwwready
-- next line will save with icon and QT preview
save window 1 in outName as GIF with makeCopy
close window 1 without saving -- the original

end repeat

end tell -- GC

end open

-- end of script
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: How to make thumbnail (From: Walter Ian Kaye <email@hidden>)

  • Prev by Date: Folder Actions & FileMaker backups
  • Next by Date: Re: XML data and QT, does it exist?
  • Previous by thread: Re: How to make thumbnail
  • Next by thread: Re: How to make thumbnail
  • Index(es):
    • Date
    • Thread