17 Replies Latest reply on Jan 3, 2016 12:22 AM by Laubender

    Embed or None

    tpk1982 Level 4

      Hi,

       

      I am trying to find the ICC profile for all links in the document. The below is the tried coding. But it not working. It show error. I thought it may be because of eps file present but not sure.

       

      for (img=0; img<app.activeDocument.allGraphics.length; img++) { 
      alert(app.activeDocument.allGraphics[img].profile)}
      

       

      Screen Shot 2015-12-29 at 5.45.57 PM.png

      The below screenshot illustrates the error details.

       

      Screen Shot 2015-12-29 at 5.47.51 PM.png

       

      I need to find the image names for "None" ICC profile. Is it possible?

       

      Advance thanks,

      Karthi

        • 1. Re: Embed or None
          tpk1982 Level 4

          Hi All,

           

          Any suggestions please.

          • 2. Re: Embed or None
            Peter Kahrel Adobe Community Professional & MVP

            The graphics object doesn't have a property 'profile', as your error message indicates, and as you'll discover when, just to make sure because you never know, you check the object model.

             

            Peter

            • 3. Re: Embed or None
              tpk1982 Level 4

              Hi Peter,

               

              Yeah but it is showing correct alert for some graphics. That is strange. So cit confused where it stopped

              • 4. Re: Embed or None
                Kasyan Servetsky Level 5

                For raster images I suggest reading the profile name from metadata like so:

                main();
                
                function main() {
                    var link, metaData, profile,
                    doc = app.activeDocument;
                    
                    for (var i = 0; i < doc.links.length; i++) {
                        link = doc.links[i];
                        metaData = link.linkXmp;
                        profile = metaData.getProperty("http://ns.adobe.com/photoshop/1.0/", "photoshop:ICCProfile");
                        $.writeln(link.name + " - " + ((profile == "") ? "No profile" : profile));
                    }
                }
                

                Here is an InDesign file I used for testing.

                 

                With vector files -- EPS, AI -- things are more complicated: I applied Edit > Assign Profile command in Illustrator. But it seems that the profile is not kept with the file: in Bridge it's displayed as untagged and I couldn't find it in metadata -- File Info > Advanced tab.

                1.jpg

                • 5. Re: Embed or None
                  tpk1982 Level 4

                  Hi Kasyan,

                   

                  If it is alert "No Profile" then we can assume it is not embedded?

                  • 6. Re: Embed or None
                    Kasyan Servetsky Level 5

                    If  property is empty string, no profile is embedded. But this doesn't work with vector images.

                    • 7. Re: Embed or None
                      tpk1982 Level 4

                      hmmm. but i placed one .ai file and ran the script..it shows "No profile"..

                      • 8. Re: Embed or None
                        Kasyan Servetsky Level 5

                        InDesign (and Bridge) doesn't see the embedded profile of EPS and AI files for some reason:

                        2.jpg

                        Though it's visible in Illustrator:

                        3.jpg

                        • 9. Re: Embed or None
                          tpk1982 Level 4

                          Thanks Kasyan. I tested one psd file and got same "No profile" alert

                           

                          Please download the PSD from the below link:

                           

                          Dropbox - example fonts and symbols.psd

                          • 10. Re: Embed or None
                            Kasyan Servetsky Level 5

                            You can't get profile name because it's not there:

                            4.jpg

                            Another approach is temporarily open it in Photoshop (via BridgeTalk) and read the profile like this:

                            #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) + "\"");
                            }
                            

                            But it says that it's not embeded.

                            5.jpg

                            So it's unavailable even directly in Photoshop. However this script was written for an earlier version and something probably has changed since.

                            There's another property in Photoshop -- colorProfileType -- which can be one of the following:

                            6.jpg

                            When I run this script in PS with your file open, I get None:

                            main();
                            
                            function main() {
                                var doc = app.activeDocument;
                                var colorProfileType = doc.colorProfileType;
                            }
                            
                            • 11. Re: Embed or None
                              tpk1982 Level 4

                              Hi Kasyan,

                               

                              Thanks for your time and explanation. The first script what you gave is useful for me.

                               

                              Regards,

                              Karthi

                              • 12. Re: Embed or None
                                Laubender Adobe Community Professional & MVP

                                Hi Kasyan,

                                in the case of the provided PSD file, the ICC profile is saved with image.

                                At least when I open it in PhotoShop, it says that there is a profile named "sRGB IEC61966-2.1".

                                 

                                And it is also showing up in the xmp-Window:

                                 

                                XMP-Window-sRGB-showing.png

                                 

                                Your script in answer #4 does not reveal the profile. I wonder why?
                                Maybe it is used in a different namespace?

                                 

                                Uwe

                                • 13. Re: Embed or None
                                  Kasyan Servetsky Level 5

                                  Hi Uwe,

                                   

                                  I looked into the raw data in Photoshop CS (Windows) but it looks a little different for me: the profile name isn't there.

                                  On your screenshot it's the 2-nd line after the </xmpMM:History> line but on my screenshot it's missing.

                                  31-12-2015 19-27-43.png

                                  Sometimes when I copy a file created on Mac to PC, I get a warning that some information will be lost. Maybe this is the case?

                                  I can't check it on my Mac at the moment because we're on vacation.

                                   

                                  Regards,
                                  Kasyan

                                   

                                  P.S. Happy New Year to the forum! :-)

                                  • 14. Re: Embed or None
                                    tpk1982 Level 4

                                    Hi Kasyan and Uwe,


                                    Advance Happy New Year wishes to you and your family.

                                     

                                     

                                    Regards,

                                    Karthi

                                    • 15. Re: Embed or None
                                      Laubender Adobe Community Professional & MVP

                                      Hi Kasyan,

                                      I had success when I selected the graphic frame holding the psd image and executed your script from answer #10, using bridgetalk and open the placed psd file in PhotoShop. The alert gave me "sRGB IEC61966-2.1".

                                       

                                      Happy New Year!

                                       

                                      Uwe

                                      • 16. Re: Embed or None
                                        Kasyan Servetsky Level 5

                                        Thanks, Uwe! Happy New Year to you!

                                         

                                        — Kas

                                        • 17. Re: Embed or None
                                          Laubender Adobe Community Professional & MVP

                                          Since I'm doing some Adobe Bridge scripting right now, alternatively we also could use Adobe Bridge instead of PhotoShop reading out the color profile.

                                          The Bridge part could be something like this:

                                           

                                          //Adobe Bridge scripting:
                                          var thumbnail = new Thumbnail(myPlacedImageFile);
                                          $.writeln(thumbnail.core.quickMetadata.colorProfile);
                                          

                                           

                                          Just an idea; I don't know if this is realiable. And it has to be addressed through bridgetalk from InDesign.

                                          Still have to gain experience with Bridge scripting which seems to be a bit strange compared to InDesign scripting.

                                           

                                          Uwe