Skip to main content
c.pfaffenbichler
Community Expert
Community Expert
July 17, 2009
Question

accessing the list of available icc-profiles with javascript

  • July 17, 2009
  • 2 replies
  • 2855 views

Once again I turn to You baffled-ly:

For some time I’ve been using a Configurator-panel with Scripts to save flattened copies (converted with various profiles and with alpha-channels removed) into Links-folders relative to files’ locations.

Doing that on only one computer meant that I could be certain the profiles were available, but when sharing that Configurator Panel with colleagues I’m afraid checking for the existence of the intended icc-profile might be indispensable/highly advisable.

Unfortunately I’ve failed to find a simple way to get a list of the installed profiles.

By the way I work with Photoshop 11.0.1 on Mac OSX 10.5.7, so it’s a Mac-thing to me.

Checking for the existence of a profile in »/Library/ColorSync/Profiles« or »~/Library/ColorSync/Profiles« would have to be done using the file-name as opposed to the name displayed in Photoshop, so that would add a little inconvenience for me and it seems a tad inelegant.

So, do You have an idea if there is an easier way to verify if an icc-profile is available using JavaScript?

Thanks for any advice.

This topic has been closed for replies.

2 replies

Inspiring
July 17, 2009

In the past, I've given user's a hardwired list of profile names then popped up a file browser to select a .icc or .icm file from disk starting in the ColorSync folder (by default) on the mac and whatever the default is on Windows. Not all profiles work like this, but it's a quick and dirty solution to the problem.

If I were going to give them a list of profiles by proper name, I'd get the profiles I could find on disk and extract the names from them using a function like this:

function getProfileNameFromFile(file) {
  file.encoding = 'BINARY';
  file.open('r');
  var str = file.read();
  file.close();
  var m = str.match(/\x00desc\x00/);
  if (m == null) {

    // if we couldn't find the magic marker, return the base filename
    return file.name.replace(/\.ic(c|m)/i, '');
  }

  var ofs = m.index+12;
  var len = str.charCodeAt(ofs);
  var s = str.substring(ofs+1, ofs+len);
  return s;
};

// Sample usage
function main() {
  var pfolder = "/Library/Application Support/Adobe/Color/Profiles/Recommended";

  var pname = "ProPhoto.icm";
  var profile = new File(pfolder + '/' + pname);

  var name = getProfileNameFromFile(profile);

  alert(pname + ' = ' + name);
};

main();

I'm not sure how general the solution is, but it does work on the subset of profile files that I've tested with.

-X

c.pfaffenbichler
Community Expert
Community Expert
July 17, 2009

Thanks a lot!

That will certainly give me something to tinker around with.

Muppet_Mark-QAl63s
Inspiring
July 17, 2009

Im NOT on my Leopard box at the moment so I have NOT looked but in Tiger that Im sat at now Photoshop's ICC Profiles are stored at:

Library/Application Support/Adobe/Color/Profiles

Library/Application Support/Adobe/Color/Profiles/Recommended

c.pfaffenbichler
Community Expert
Community Expert
July 17, 2009

So two more places to look.

Thanks for pointing that out!