• 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 script resizing in Graphic Converter (Use QT)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to script resizing in Graphic Converter (Use QT)


  • Subject: Re: how to script resizing in Graphic Converter (Use QT)
  • From: Chris Adams <email@hidden>
  • Date: Sat, 07 Jul 2001 03:32:50 +0000

Here is a script that uses Quicktime to do this. I can be automated to work
through a file. It is part of a very large script thate generates HTML
pages and compresses the images in Media Cleaner. The big script is online
here:

http://www.cypresslakestudios.com/applescript/index.html#photo_albummer

-- ===========================
-- cut and paste from here
-- The QT part of the script:
-- ===========================
-- open in QT & get height and width

tell application "QuickTime Player"

activate

open currentFileAlias -- set this to your image file

-- get width and height of image
set mydimensions to dimensions of movie 1 as list

set width to item 1 of mydimensions
set height to item 2 of mydimensions
end tell
-- ************************************
-- export small version of the picture
-- ************************************
set smallTargetWidth to 110 -- your target width
set smallTargetHeight to 110 -- target height

-- This method means that a picture of any aspect
-- ratio will for within a 110x110 area.
-- a tall picture will be 110 pixels high, and
-- a wide picture will be 110 pixels wide

tell application "QuickTime Player"
if width > height then -- use target width
set aspect to height / width
-- checks aspect ratio of picture: if tall then use target height,
if wide then width

set smallWidth to smallTargetWidth
-- div operand makes a whole number
set smallHeight to smallTargetWidth * aspect div 1

-- changes dimensions of movie:

set dimensions of movie 1 to {smallWidth, smallHeight}

else
--if width < height then use target height
set aspect to height / width
-- checks aspect ratio of picture: if tall then use target height,
if wide than width

set smallHeight to smallTargetHeight
set smallWidth to smallTargetHeight div aspect


end if

-- save in smallFolder. You must identify smallFolder somehow.

tell application "Finder"
-- This copies the current file into the new directory


set tempFile to (duplicate currentFileAlias to smallFolder) as alias

end tell
tell application "QuickTime Player"
-- The resized version is then saved over it
export movie 1 to tempFile as picture using default settings

-- finish

close movie 1 saving no

end tell
end tell

-- ===========================
-- end script
-- ===========================


Hope this helps.


--
Chris Adams
Cypress Lake Studios
Hypermedia, Quicktime, and Internet Design
http://www.cypresslakestudios.com
email@hidden


References: 
 >Re: how to script resizing in Graphic Converter (From: "Marc K. Myers" <email@hidden>)

  • Prev by Date: Re: [Ann]: KinderShell.osax is now on www.osaxen.com
  • Next by Date: Re: Offset vs. Repeat loops
  • Previous by thread: Re: how to script resizing in Graphic Converter
  • Next by thread: Re: how to script resizing in Graphic Converter
  • Index(es):
    • Date
    • Thread