Removing Color Profiles

I am working on a script to remove the color profiles from the images I select. However, I can’t seem to figure out how I would set the color profile to none. This is what I’m using:

tell application "Finder"
	set sel to selection
	repeat with eachImage in sel
		tell application "Image Events"
			launch
			set openPic to open (eachImage as text)
			set theProfile to profile of openPic
			set profile of openPic to ""
			close openPic
		end tell
	end repeat
end tell

When I run the script, I get error number -10000. I can’t figure out what I set the profile to; whether it’s a string, or a list, or both.

Please and thanks!

Hi,

the dictionary of Image Events says, that profile responds to the delete command

try

delete profile of openPic

or

delete every profile of openPic

Hmm, I try this, just like you said:

tell application "Finder"
	set sel to selection
	repeat with eachImage in sel
		tell application "Image Events"
			launch
			set openPic to open (eachImage as text)
			delete profile of openPic
			close openPic
		end tell
	end repeat
end tell

I get error “Image Events got an error: profile of image “Picture.png” doesn’t understand the delete message.” number -1708

have you also tried every profile or profile 1?

I get the same thing.

hi,
there should be a default AppleScript on your mac which uses application “ColorSyncScripting” to unembed profiles …

Have a look :slight_smile:

Unfortunately ColorSyncScripting no longer exists in 10.6.

My suggestion would be to use “do shell script” and sips. Image Events is just too hit-and-miss.

Can you tell me how I would remove a color profile with sips?

Go into terminal and type man sips. You probably want something like this:

do shell script ("sips --deleteProperty profile " & quoted form of POSIX path of theFile)

Works flawlessly. Thanks so much!

Now to run the script for all of my images. :smiley: