Copy link to clipboard
Copied
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?
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you, that's exactly what i wanted!
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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) + "\"");
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now