Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get icc-profile from a image

Community Beginner ,
Jan 11, 2011 Jan 11, 2011

Is ist possible to get the ICC-profile of a image

I try this with  a Adobe RGB 1998 with embeded profile:


alert(app.activeDocument.selection[0].graphics[0] .profile);
alert(app.activeDocument.selection[0].graphics[0] .space);

But it only return  "Emdeded" for .profile and "RGB" for .space. But i want it to return adobe rgb 1998

Is it possible?

TOPICS
Scripting
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jan 11, 2011 Jan 11, 2011

As far as I know, you can't get profile of an image directly in InDesign, but you can get it via metadata:

var link = app.selection[0].graphics[0].itemLink;
var linkXmp = link.linkXmp;
var profile = linkXmp.getProperty("http://ns.adobe.com/photoshop/1.0/", "ICCProfile");
alert(profile);

However not all images contain the nesessary metadata, especially some old files.

You can check this by choosing Link File Info (in Links Panel menu) and going to Advanced section.

12.01.png

Translate
Valorous Hero ,
Jan 11, 2011 Jan 11, 2011

As far as I know, you can't get profile of an image directly in InDesign, but you can get it via metadata:

var link = app.selection[0].graphics[0].itemLink;
var linkXmp = link.linkXmp;
var profile = linkXmp.getProperty("http://ns.adobe.com/photoshop/1.0/", "ICCProfile");
alert(profile);

However not all images contain the nesessary metadata, especially some old files.

You can check this by choosing Link File Info (in Links Panel menu) and going to Advanced section.

12.01.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 12, 2011 Jan 12, 2011

Thank you, that's exactly what i wanted!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 13, 2011 Jan 13, 2011

Why can't i read  the profile variable from PSD-documents file don't contain xmp profile variable when i look under link file info. But when i look link information i can read profile: adobe rgb

Read from XMP script also don't work.

But when i open i photoshop i can read it

Bug?

ps_vs_indesign_cs3.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 17, 2011 Jan 17, 2011
LATEST

I can't think nothing better than temporarily open the link in Photoshop and get its embedded profile from there:

#target indesign
#targetengine "session"

if (!BridgeTalk.isRunning("photoshop")) {
     alert("Photoshop is not running.");
}
else {
     var link = app.selection[0].graphics[0].itemLink;
     CreateBridgeTalkMessage(link.filePath);
}

function CreateBridgeTalkMessage(filePath) {
     var bt = new BridgeTalk();
     bt.target = "photoshop";
     var script = GetProfile.toString() + "\r";
     script += "GetProfile(\""  + filePath + "\");";
     bt.body = script;
     // $.writeln(script);
     bt.onResult = function(resObj) {
          var result = resObj.body;
          DisplayProfile(result);
     }
     bt.send(100);
}

function GetProfile(filePath) {
     try {
          app.displayDialogs = DialogModes.NO;
          var psDoc = app.open(new File(filePath));
          var prof = app.activeDocument.colorProfileName;
          psDoc.close(SaveOptions.DONOTSAVECHANGES);
          app.displayDialogs = DialogModes.ALL;
          return prof;
     }
     catch(err) {
          psDoc.close(SaveOptions.DONOTSAVECHANGES);
          app.displayDialogs = DialogModes.ALL;
     }
}

function DisplayProfile(result) {
     alert( "Color profile is \"" + ((result == "undefined") ? "Not embedded" : result) + "\"");
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines