App for batch assigning/converting ICC profiles?

Anybody know of a great (Mac OS) app or command line utility for automatically and efficiently batch assigning/converting icc profiles to potentially hundreds of files at once? I wish I knew more about scripting/coding but I just don’t have time for that rabbit hole right now, haha. I’d like to be able to designate a simple pipeline along the lines of “Assign [profile A], then convert to [profile B] using [rendering intent] [with/without] Black Point Compensation and save/copy in image folder/sub-folder as Jpeg/Tiff with/without embedding profile. Ideally I’d be able to have it work automatically, just by dropping a folder of images onto the app icon or with a simple terminal command. Oh, and it needs to be compatible with ICC v4 profiles. Thanks!!

Not exactly sure what you are doing but I think maybe you could use something like this…

There is an example at the bottom of the page that might be like what you are trying to do?? (or maybe Exiftool??)

exiftool can apply an ICC profile, but I don’t think it can convert from one profile to another.

ImageMagick can.

IMagick is an interface between PHP and ImageMagick. That would work. I don’t use PHP so can’t advise.

ImageMagick can be used at the command line or in scripts. A sample command would be:

magick in.ext -set profile profA.icc -intent Perceptual -black-point-compensation -profile profB.icc +profile *.icc out.jpg

For multiple files, I would put put this inside a “for” loop.

V2 or V4 profiles can be used. Not all ICC profiles support all intents.

1 Like

img, the command line program that goes with rawproc can do both assign and convert:

$ img foo.jpg colorspace:bar.icc,assign foo-assigned.jpg
$ img foo.jpg colorspace:bar.icc,convert,relative_colorimetric foo-converted.jpg

Edit: almost forgot, you can use wildcards in the input/output filespecs, just quote the filespec so the shell doesn’t try to interpret them.

Edit1: Oh, and the ICC profile needs to be in the directory identified in the cms.profilepath property

Edit2: And, and, convert in the command line I wrote above requires that the input image contain an embedded profile. If not, you can do two colorspace tools on the command line, the first one to assign a profile, the second to do the convert.

Also worth noting that this is a potentially lossy operation depending on how you IM is built (quantum depth of 8 bits, 16 bits, or HDRI, i.e. float).

In my sample command above, “+profile *.icc” removes the embedded profile, so downstream software will assume the image is sRGB. This may reduce colour accuracy because not all sRGB profiles are equal.

True. If performance is critical, I suggest using the appropriate IM build for the files. For example, if the files are 8-bit integer then IM Q8 without HDRI will be fastest. When performance is not critical, I suggest Q16 with HDRI.

Mine is pretty similar.
I always use something like (on windows ) :

for %i in (*.tif) do magick %i +profile "*" -profile assigned.icc -intent relative -black-point-compensation -profile converted.icc -compress none %~ni_work.tif

This takes *.tif and creates new files *_work.tif eith the profile assignment/conversion . But as others said, this works because I go from uncompressed to uncompressed, so no loss for resaving a file.

For assigning a profile I use exiftool :

for %i in (*.jpg) do exiftool "-icc_profile<=assigned.icc" -overwrite_original %i

But as the command shows , this overwrites the original jpg files (but that’s my use case mostly ).

If you want to convert the profile in a jpg, you might as well use the Magick command, since you are changing pixels, there is no lossless mode here.

There is also a ‘cctiff’ command in the Argyll utilities if I remember correctly. It can assign and convert (or at least convert from and to an ICC regardless of assigned ICC ).

On a bash shell (Linux) you can use something like

for i in *.tif; do magick $i rest of command ${i#*.tif}_work.tif; done

I hope I have that last variable correct , doing this from memory.

What is the common use case for this.

Different things.

My scans are untagged, and need applying the calibration-profile. Then I convert to a working profile to do my edits / inversions. Finally, I convert back to sRGB for web or to a calibration profile of my printer if I’m making a print.

In other cases, my web exports I mostly convert from uncompressed working files to jpeg by using mozjpeg for highly optimized jpg files. But that strips out all the metadata, including any profile that might be applied to it.

‘A common use case’ is not something that exists in picture / photo editing I think… Everyone has a different workflow :slight_smile: .

I should have said some use cases :slight_smile:
thanks for sharing