• 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
Scaling large images w/ Akua Sweets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scaling large images w/ Akua Sweets


  • Subject: Scaling large images w/ Akua Sweets
  • From: Landis <email@hidden>
  • Date: Mon, 22 Oct 2001 17:11:41 -0700

I'm brand new to the list, and pretty new to scripting. Having searched the archives of the list, I've gotten a lot of good examples but I'm hoping that someone out there might be able to help me with some specifics.

I've got lots of PICTs that are fairly large (40+ MB) that I need to scale depending on their pixel dimensions. I normally use PhotoShop, but without shelling out another $300 for a 3rd party scripting extension, it's plain useless with AppleScript. Going thorough the archives, I've found several mentions of Akua Sweets w/ examples (pretty awesome stuff). I've gotten a lot of what I want done, but I can't quite get the syntax for scaling and saving the new image.

Here's what I've got:

--BEGIN SCRIPT
set imgFile to (choose file with prompt "Choose any PICT file")

-- use "Akua Sweets"
-- check that Quicktime's image importer can read it
if (the image type in imgFile) is "PICT" then

-- get Mac 'pict' object from image file
set thePict to the image from imgFile with proxy return

-- get picture information
set picInfo to the picture info for thePict

-- get picture
set picBounds to picture bounds of picInfo -- {left, top, right, bottom}

-- get width and height...
set WidthO to (item 3 of picBounds as string)
set HeightO to (item 4 of picBounds as string)

--calculate L, M, & S series sizes that will work
set HeightL to ((round (HeightO / 196)) * 196)
set WidthL to ((round (WidthO / 4)) * 4)

--scale image and save
set ImageL to (scale image thePict to {WidthL, HeightL})
set FileL to (choose file name with prompt "Save resized PICT as")
store image (scale image thePict to {WidthL, HeightL}) in FileL as "PICT"

--Free the RAM
dispose proxy data thePict

end if
--END SCRIPT

The script seems to run just fine, but it doesn't actually save anything. It asks me where I want the file, and what to call it, then finishes up, but the new file never materializes. Also my RAM seems to be getting used up (the partition for the Finder gets bigger and bigger, but doesn't actually get used (or returned)). Any suggestions or help that any one could bestow on a new scripter? If anyone needs a 40MB PICT to try this out, let me know :)
(they're about 1500 pixels wide by 9500 tall).

Thanks for any help!

Landis

BTW OS 9.1, AKUA 1.43, AppleScript 1.6


  • Follow-Ups:
    • Re: Scaling large images w/ Akua Sweets
      • From: Chris Adams <email@hidden>
  • Prev by Date: Re: Scripting additions and X
  • Next by Date: Re: copy & set statements
  • Previous by thread: Re: Write a Script for Now-Up-To-Date
  • Next by thread: Re: Scaling large images w/ Akua Sweets
  • Index(es):
    • Date
    • Thread