How do I remove a ColorSync profile from a JPEG image from Terminal in El Capitan?
I have several images that I would like to strip the ColorSync profile from. Eventually, I would like to automate this in bash so I could easily process this on a file or folder from the contextual menu using an Automator service.
How do I strip a color profile from an image file using Terminal?
Solution 1:
Use sips
(scriptable image processing system) to remove an ICC color profile from an image file in El Capitan. sips
does a ton of other stuff as well.
To remove the ColorSync ICC profile from an image:
sips -d profile --deleteColorManagementProperties <imagefile>
Example:
MyFILE="${HOME}/Pictures/RemoveMyColorSyncProfile.jpg";
sips -d profile --deleteColorManagementProperties "${MyFILE}";
It appears to support the following image types, but I'm basing this on the format
image property key (see Options in the man page):
- jpeg
- tiff
- png
- gif
- jp2
- pict
- bmp
- qtif
- psd
- sgi
- tga
See the man page for more info, or use sips -h
for help to stdout.
Solution 2:
OP @Emeraldo's answer is on-target: you can use the sips
(scriptable image processing system) terminal command to remove the color profile from a JPEG (or PNG) image. This is often necessary to get colors in an image produced with a graphics app to render correctly in a browser.
I will add that Apple provides a script that will do this for you without you having to open a terminal or remember the slightly non-trivial command syntax. In /System/Library/Scripts/ColorSync
(/Library/Scripts/ColorSync
on Catalina) is an AppleScript droplet, Remove.app
. If you drop one or more image files on it, it removes the color profile(s). If you open the droplet with Script Editor, you'll find it runs a sips
command, just as @Emeraldo described. The original question indicated a hope to automate the process in Automator; this script would be a great starting place for that (if its function as a droplet isn't already enough for the stated batch conversion task).
I don't know for how long this script has been available, but on my High Sierra system the app file has a 2012 creation data. The script itself has comment giving a 2009 date. So I suspect it's been around for a while. I wish I'd known about it years ago. I used to use a Dashboard widget called "PNG Pong" for this, but it's no long available. I learned about the droplet from a 2010 Adobe forum post: How to remove color profile from an image | Adobe Community (though the script's location has slightly changed since 2010).