2 Replies Latest reply on Oct 18, 2015 10:47 PM by natrev

    Color profile - conditions

    polkomatik

      I have a task to solve and I don't know how to write a condition. Maybe you can help : "Create a script that detects if the image uses a color profile. If used, the script should report the name. If not used, it must inform the user that does not use color profile".

        • 1. Re: Color profile - conditions
          xbytor2 Level 4

          Try this:

           

          if (app.activeDocument.colorProfileType == ColorProfileType.NONE) {

            alert("This image does not have a Color Profile");

          } else {

            alert("The Color Profile of this image is: " + doc.colorProfileName);

          }

          • 2. Re: Color profile - conditions
            natrev Level 3

            Hi Polkomatik,

             

            Try this...

             

                CHK_Profile();   

                function CHK_Profile(){

                    var doc = app.activeDocument;

                    var myDocname=doc.name

                    try {

                        var ecp=doc.colorProfileName;  

                        alert("The Color Profile is - " + doc.colorProfileName);

                       }

                    catch (er) {

                        alert("The Image has untagged color profile.. !!!\n\n");

                        }     

                   }