Skip to main content
Participant
July 7, 2011
Question

[JS2, CS2] Identifying RGB images with Script

  • July 7, 2011
  • 1 reply
  • 474 views

Is there a way to identify RGB images in a document using javascript? I know it's available in preflight but for various reasons I'm trying to avoid this.

This topic has been closed for replies.

1 reply

John Hawkinson
Inspiring
July 7, 2011

CS2? Whoa. In CS5:

>> app.selection[0].images[0].space
RGB

I couldn't tell you about CS2.

Participant
July 7, 2011

Found the answer in a script Kasyan wrote: ( http://kasyan.ho.com.ua/convert_cmyk-rgb_images_to_grayscale.html )

And altered it slightly to suit my needs...

var RGBimages = new Array;
var myLinks = app.activeDocument.links;

for ( i = 0; i < myLinks.length; i++ )  {
    var link = links;
    if (link.status == LinkStatus.NORMAL) {
        if (image.space == "RGB") {
            RGBimages.push( myLinks.name );
        }
    }
}