Info about Alpha-Channels

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

klevteev
Posts: 17
Joined: Wed Nov 06, 2019 1:22 pm

Info about Alpha-Channels

Post by klevteev »

Hello All!
How can I add information about alpha-channels to parametres to dialog box?
or delete everything except CMYK
User avatar
Stephen_A_Marsh
Posts: 29
Joined: Sun Aug 04, 2019 12:37 pm

Re: Info about Alpha-Channels

Post by Stephen_A_Marsh »

I'm a little late to the party, however, I hope this helps @klevteev or somebody else...

Code: Select all

// CMYK mode file: remove all channels except for the composite channel
if (documents.length > 0) {
    if (activeDocument.mode == DocumentMode.CMYK) {
        try {
            for (var i = activeDocument.channels.length - 1; i >= 0; i--) {
                if (activeDocument.channels[i].kind != ChannelType.COMPONENT) {
                    activeDocument.channels[i].remove();
                }
            }
        } catch (e) {}
    }
} else {
    alert("There must be at least one open document to run this script!");
}