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

Need log report for Image ICC Profile name - Indesign

Explorer ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

Hi All,

Could you please assist me in finding the ICC profile name of the images - Using InDesign JavaScript?

I have attached the image for more information

Thank you,
Magesh

TOPICS
Scripting

Views

330

Translate

Translate

Report

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

Community Expert , Aug 01, 2023 Aug 01, 2023

Hi @Mageshwaran , I don’t think an image’s profile name is directly exposed anywhere in the API—if you try to get the image .profile property it will tell you whether InDesign is using the profile (embedded) or whether the fallback profile is being used (Use Document Default).

 

If it is embedded, you can get the image’s profile name from the Link Info dialog. I can’t rememer who posted this but you can extract Link Info items from the clipboard like this:

 

 

 



 var lnks = app.documents[0].li
...

Votes

Translate

Translate
Community Expert ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

Hi @Mageshwaran , I don’t think an image’s profile name is directly exposed anywhere in the API—if you try to get the image .profile property it will tell you whether InDesign is using the profile (embedded) or whether the fallback profile is being used (Use Document Default).

 

If it is embedded, you can get the image’s profile name from the Link Info dialog. I can’t rememer who posted this but you can extract Link Info items from the clipboard like this:

 

 

 



 var lnks = app.documents[0].links;
 var pd = "";
for (var i = 0; i < lnks.length; i++) {
    lnks[i].parent.select();
    var n = lnks[i].name;
    pd = GetLinkInfo('ICC Profile')
    
    $.writeln(n + ":\nICC Profile: " + pd + "\n")
    //returns the image name and its ICC Profile setting
} 


/**
* Gets a selection’s Link Info
* @ param the LinkInfo Item string
* Size, ICC Profile, Layer Overrides, Transparency, Dimensions, Format, Creator, Place Date, Modified, Creation Date
* @ returns the Link Info property as a string
*/

function GetLinkInfo(s){
    var ds = "Not Defined"
    var linfo = app.menuActions.itemByName('$ID/#LinksUICopyLinkInfoMenu');
    var lp = app.menuActions.itemByName('$ID/Links')
	try{linfo.invoke()}
	catch(e){
        lp.invoke();
        if (linfo.enabled) {
            linfo.invoke()
        } 
	}
	app.menuActions.itemByName('$ID/Links').invoke()
	var tf = app.activeDocument.pages[0].textFrames.add()
	tf.parentStory.texts[0].select()
	app.paste()
	var c = tf.parentStory.contents
	tf.remove()
	app.menuActions.itemByName('$ID/Selection Tool').invoke()
	for(var i = 0; i < c.split('\r').length; i++){
		if(c.split('\r')[i].split('\t')[0] == s){
            ds = c.split('\r')[i].split('\t')[1]
		}
	} 
    return ds
}

 

 

 

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

I would rather recommend using the XMP Library:

https://extendscript.docsforadobe.dev/scripting-xmp/accessing-the-xmp-scripting-api.html


You will find many posts around with samples.

 

HTH

Loic

Votes

Translate

Translate

Report

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
Explorer ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

Thank you very much for your help.

Votes

Translate

Translate

Report

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
Explorer ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

LATEST

Thank you very much for your help

Votes

Translate

Translate

Report

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 Expert ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

Hi @Mageshwaran and @rob day ,

found this one below from January 2011 where Kasyan Servetsky extracted information of the image's color profile through XMP meta data or by opening the image with PhotoShop using BridgeTalk and PhotoShop scripting:

 

Get icc-profile from a image
Kasyan Servetsky, Jan 11, 2011
https://community.adobe.com/t5/indesign-discussions/get-icc-profile-from-a-image/m-p/3208959#M323313

 

Rob, I ran your script on the attached document and the also attached image placed.

The result was:

SampleImage.jpg:
ICC Profile: undefined

 

Also ran Kasyan's script on the selected graphic frame of the placed image.

PhotoShop was open before starting the script.

This time with a better result:

Color profile is "sRGB IEC61966-2.1"

 

Slightly edited Kasyan's code. Removed the #target "indesign" statement and changed the alert() to a $.writeln().

The placed image was selected in this case. Code below that I ran from the ESTK on my Windows 10 machine:

 

/**
* @@@BUILDINFO@@@ GetICCprofileFromSelectedImage-Kasyan Servetsky-v1.jsx !Version! Tue Aug 01 2023 20:31:02 GMT+0200
*/


/*
	Script by Kasyan Servetsky at the Adobe InDesign Forum:
	
	Kasyan Servetsky, Jan 17, 2011
	https://community.adobe.com/t5/indesign-discussions/get-icc-profile-from-a-image/m-p/3208959#M323313
	
	Get icc-profile from a image
	Quoting Kasyan:
	I can't think nothing better than temporarily open the link in Photoshop and get its embedded profile from there:
	
*/

/*
	NOTE BY Uwe Laubender:
	All tests done with InDesign 2023 and PhotoShop 2023 both running together on Windows 10.
	Script running from the ESTK ( ExtendScript Toolkit App )
*/

// #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) {
    $.writeln( "Color profile is \"" + ((result == "undefined") ? "Not embedded" : result) + "\"");
}

 

Regards,
Uwe Laubender
( Adobe Community Expert )

 

Votes

Translate

Translate

Report

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 Expert ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

Kasyan's first attempt with the following code:

/**
* @@@BUILDINFO@@@ GetICCprofileFromSelectedImage-Kasyan Servetsky-usingXMP-v2.jsx !Version! Tue Aug 01 2023 20:50:31 GMT+0200
*/
/*
	
	Get icc-profile from a image
	Kasyan Servetsky, Jan 11, 2011
	https://community.adobe.com/t5/indesign-discussions/get-icc-profile-from-a-image/m-p/3208956#M323310
*/

// Graphic frame with image selected:

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

was also successful with my sample data from my last reply.

 

Source:

Get icc-profile from a image
Kasyan Servetsky, Jan 11, 2011
https://community.adobe.com/t5/indesign-discussions/get-icc-profile-from-a-image/m-p/3208956#M323310

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Votes

Translate

Translate

Report

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 Expert ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

Hi Uwe, Thanks for sharing the linkXMP option. I’m not sure what @Mageshwaran intends to do with the ICC Profile Link Info, but something to watchout for is the embedded profile might not be used to color manage the image.

 

In this example the document’s CMYK Color Mangement Policy is Preserve Numbers (Ignore Linked Profiles), so Kaysan’s script returns Coated GRACoL 2006, which is literally the embedded profile, but because of the policy, the image is listed as Document CMYK, which in this case is Japan Color 2001 Coated—the embedded GRACoL profile is being ignored. So if you are trying to get the Link Info ICC Profile the .linkXmp property doesn’t necessarily work

 

 

var link = app.selection[0].graphics[0].itemLink;
var linkXmp = link.linkXmp;
var profile = linkXmp.getProperty("http://ns.adobe.com/photoshop/1.0/", "ICCProfile");
$.writeln(profile);
//returns Coated GRACoL 2006 (ISO 12647-2:2004)

$.writeln("Document CMYK = " + app.activeDocument.cmykProfile)
//Returns Document CMYK = Japan Color 2001 Coated

 

 

Screen Shot 12.png

 

Votes

Translate

Translate

Report

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 Expert ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

Hi Rob,

yes, that's a very important point!

 

Roland Dreger's script Color Script 1.0.8 can handle this situation in a excellent way. With tab "Correction" ("Korrigieren") you can see that the selected image is using the document standard.

See attached screenshot. Also the attached InDesign document with the placed and selected image.

 

FWIW: With tab "Setting" ("Einstellen") in Roland's script you can see how the working spaces are defined.

 

@Mageshwaran : Roland Dreger's script can be downloaded from

https://www.rolanddreger.net/de/1/farbmanagement-in-adobe-indesign/#

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Votes

Translate

Translate

Report

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 Expert ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

I have not tried Roland’s script, but there’s also the possibility of a profile override, so here I’ve overriden the selected image’s embedded profile with US Sheetfed Coated v2—again not sure if @Mageshwaran wants the embedded profile or the Link Info panel’s listed profile:

 

alert(GetLinkInfo('ICC Profile'))

//returns the override profile
//+ U.S. Sheetfed Coated v2 (override)

 

Screen Shot 17.png

Votes

Translate

Translate

Report

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