ColorSync & Image Events

I am unable to figure out how to get a ICC profile to be embeded or matched using Image Events Applescript.
I would have thought this would work:

set this_file to choose file 

with timeout of 180 seconds 
tell application "Image Events" 
launch 
try 
set this_image to open this_file 
on error errMessage 
return "Error Opening " & this_file & errMessage as text 
end try 
get default RGB profile location --as text 
--set def_RGB to result as string 
set the image_props to the properties of this_image 
tell this_image 
copy dimensions to the {the_width, the_height} 
set file_type to file type 
set color_space to color space 
set bit_depth to bit depth 
set res to resolution 
--set display_moniter to name of display profile 
end tell 
set the_comment to "Image information:" & return & "File Type: " & file_type & return & ¬ 
"Width: " & the_width & "Height: " & the_height & return & ¬ 
"Resolution: " & res & return & ¬ 
"Color Space: " & color_space & return & ¬ 
"Bit depth: " & bit_depth & return as string 
tell application "Finder" to set comment of this_file to the_comment 
try 
--tell this_image 
embed this_image with source default RGB profile 
--end tell 
--match this_image to destination default RGB profile 
on error errMessage 
close this_image 
return "Error ICC Profile: " & errMessage 
end try 

try 
scale this_image to size 500 
on error errMessage 
return "Error Sizing " & this_file & errMessage as text 
end try 
try 
set the W500_image to save this_image as JPEG in file newJPG_name of folder Target with icon 
on error errMessage 
return "Error Saving " & this_file as text 
end try 
close this_image 
set path_W500_image to dest_500 --as alias 
end tell 
end timeout 

I am able to get sips working from the command line:

sips ~/Pictures/Chooseanimage.tif --setProperty format tiff --matchTo /Library/ColorSync/Profiles/Apple Studio Display Profile.icc --out ~/Pictures
Note: make sure you check this line before running, you may not have this icc profile

Brandon,

I have been waiting to see if you got a reply to resolve the problem you are having with Image Events and colorsync.

I can’t help you with Image Events but I believe that iMagine Photo can probably do what you need and I know that you already use it.

iMagine Photo can also attach color profiles to image files when it exports. It can only add an a color profile that is already in an image file but this will still give you what you need from within AppleScript. All you need is a single image file that already has the default color profile for your display in it and you can attache it. Or if you want to process your image files without applying the color profile embedded in your image file, iMagine Photo can do that, and then attach the original profile to your image.

To see how to turn off color matching check out the documentation at the end of the section:

http://www.yvs.eu.com/documentation/importinggraphic.html

To see how to attach a color profile to your image before exporting, the documentation for it is near the end of the colorsync documentation:

http://www.yvs.eu.com/documentation/colorsync.html

Kevin

I do use iMagine Photo and I am going to be able to implement it even more now that it is free (Sorry but the company I work for is cheap…). I had not used its color capabilities but I will give it a go.
The purpose of my test was to see which was faster. ColorSyncScript is slow compared to the cli of sips. I was attempting differant tests and have not been able to simply figure out the proper scripting method for profile implementation that is suggested by Apple and others.
So far I have been able to get PhotoShop out my processes completely. With the exception of gif exportation. I have used Debabilizer, Imagick, GIMP and others that have gif exportation. But none do as good a job as PS.
Thanks for the tip and I will jump right in on my tests.
Brandon