Skip to main content
Participant
October 17, 2015
Question

Color profile - conditions

  • October 17, 2015
  • 2 replies
  • 580 views

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".

This topic has been closed for replies.

2 replies

natrev
Legend
October 19, 2015

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");

            }     

       }

Inspiring
October 18, 2015

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);

}