Skip to main content
namodayab94056659
Known Participant
April 23, 2019
Answered

Identify the incompatible color channels are present in the document

  • April 23, 2019
  • 2 replies
  • 1018 views

If I delete the color channel as below, File -> Export -> Save for web option is disabled. Therefore I cannot perform the ExportOptionsSaveForWeb() Photoshop API.

I want to identify that incompatible color channels are present in the document (Save for web option is disabled)

( Note: When the document has RGB color channels as below, Save for web option is enabled. )

Anyone please help me to find the way to identify the incompatible color channels are present in the document?

This topic has been closed for replies.
Correct answer c.pfaffenbichler

Are you sure you use the word »incompatible« correctly?

If one removes an RGB or CMYK channel the composite channel disappears in the Channels Panel and the document’s mode becomes DocumentMode.MULTICHANNEL

Would that be sufficient for making the distinction?

2 replies

Legend
April 23, 2019

If I understood correctly.


CC2018.

The script checks the availability of the command "Save For Web"

var r = new ActionReference();

r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

 

var d = new ActionDescriptor(); 

d.putReference(stringIDToTypeID("null"), r);   

d.putString (stringIDToTypeID("command"), "getCommandEnabled");   

d.putDouble(stringIDToTypeID("commandID"), 1695 );   

var s4w_enabled = executeAction(stringIDToTypeID("uiInfo"), d, DialogModes.NO).getObjectValue(stringIDToTypeID("result")).getBoolean(stringIDToTypeID("enabled"));

alert(s4w_enabled);

namodayab94056659
Known Participant
April 24, 2019

Thank you very much r-bin​.

This solution is working only Photoshop CC2018 and CC2017.

I want to execute it Photoshop CC2018, CC2017, CC2015.5 and 2014.

Do you have an idea about the common solution for the all versions?

c.pfaffenbichler
Community Expert
c.pfaffenbichlerCommunity ExpertCorrect answer
Community Expert
April 23, 2019

Are you sure you use the word »incompatible« correctly?

If one removes an RGB or CMYK channel the composite channel disappears in the Channels Panel and the document’s mode becomes DocumentMode.MULTICHANNEL

Would that be sufficient for making the distinction?

namodayab94056659
Known Participant
April 24, 2019

Thank you very much c.pfaffenbichler​.

It is working. Are there any other user scenarios that can be become DocumentMode.MULTICHANNEL except deleting color channels?

I want to distinguish with it other scenarios.

c.pfaffenbichler
Community Expert
Community Expert
April 24, 2019

One can change an image to Multichannel manually (Image > Mode > …) but in this case Save for Web is inapplicable, too.

You may want to ultimately go with r-bin’s approach.