OT: Apple Script Paths -- Image Processing
Sivakatirswami
katir at hindu.org
Tue Feb 6 18:55:22 EST 2007
All OSX only:
We run a number of in house production rev apps to process photos.
I build batch actions in ImageReady, then save these as "droplets"
on the main in-house server on the LAN ... his name is "Varuna"
inside the Rev GUI I keep a hidden field with this little applescript
and replacement strings.
tell application "Finder"
open "--Path--##file##" using "Varuna:TAKA: TAKA Photo Pre-Op and
reserves:##dropletName##"
end tell
OK we are having the old and well known challenges of paths in AppleScript
If I pick a photo on the server... will get this: and it runs fine:
tell application "Finder"
open "Varuna:TAKA:IMG_6890.jpg" using "Varuna:TAKA: TAKA Photo
Pre-Op and reserves:Rotate CW 90"
end tell
Mac OSX knows that the droplet is an ImageReady file.. and it runs fine.
Paths work, out of the box
But, if I pick a folder on the local file machine:
tell application "Finder"
open ":Users:katir:Desktop:Text:TAKA:IMG_6890.jpg" using
"Varuna:TAKA: TAKA Photo Pre-Op and reserves:Rotate CW 90"
end tell
it doesn't work... ok old rule: debug your applescripts in AppleScript
Editor first, and *then* use in REv... OK.. over to ScriptEditor.app
So, there is a known issue that the top drive must be declared:
tell application "Finder"
open ":Users:katir:Desktop:Text:TAKA:IMG_6890.jpg" using
"Varuna:TAKA: TAKA Photo Pre-Op and reserves:Rotate CW 90"
end tell
# Error --> can't get file: :Users:katir:Desktop:Test:TAKA:IMG_6890.jpg
but if you manually insert
tell application "Finder"
open "Macintosh HD:Users:katir:Desktop:Test:TAKA:IMG_6890.jpg"
using "Varuna:TAKA: TAKA Photo Pre-Op and reserves:Rotate CW 90"
end tell
Then it works...
in theory I should be able to dig the name of the machine with a POSIX
conversion like this:
where Rev is passing "/Users/katir/Desktop/someFooPhoto.jpg" to the script
tell application "Finder:
set tPath to "/Users/katir/Desktop/someFooPhoto.jpg"
set tImagePath to POSIX file tPath
#should return according to discussions on lists on the net:
file --> ""Macintosh HD:Users:katir:Desktop:someFooPhoto.jpg"
But I'm still getting an error msg,
"Finder got an error: Can't get POSIX file
"/Users/katir/ RevData/ApplicationGraphics/test/IMG_6890.jpg"
And it does not help to remove all spaces from the folder names.
but if I manually script in
"Macintosh HD" (using the "drives() function) then it works,
Anyone know why the POSIX conversion is failing?
A "smoother" solution would be: direct image pixel manipulation:
"super cool" to do these with Apple's native CoreImage
processor,
but there is learning curve there. Typically all I want to do is
downsize the photo, run autolevels, unsharp mask and save to JPG medium.
Its a simple, standard prep for web routine. No manual touchup...not sure
we need such heavy artillery as CoreImage for this...but the inter process
(talking to ImageReady w/Applescript) is such a pain...
Is anyone else here using CoreImage for raw image processing?
Anyone know if there are some Core Image Processor libraries we an grab
to plug into Rev to use for this kind of image processing (not for
transitions)?
The quality of the JPEG compressor on Rev is seriously deficient compared
to what we get out of ImageReady.. which is why I am jumping thru all these
hoops to do some pretty simple image processing stuff (rotate clockwise
90, rotate
CCW 90, etc)
Downsizing a 2.5 megapixel camera image to 350 X 245 JPEG quality
40, in Rev gives comparable file size as ImageReady, but the Rev version is
way "fuzzy" compared to ImageReady's output for the same 28-40K result
file.
and If I rotate a pre-processed image in Rev and re-save, more
degradation that we don't see if we rotate in ImageReady...
TIA
In Peace
Sivakatirswami
www.himalayanacademy.com
More information about the use-livecode
mailing list