How To Convert To RGB

I’m exploring the Docs more trying to do more using what’s available in the API-2

Im trying to understand how to convert a document from GrayScale into RGB.

const grayScale = constants.DocumentMode.GRAYSCALE;

if (grayScale) {
// convert it ...
}

I belive it has something to do with Document.changeMode but cannot get my head round the command.

Document.chaneMode("RGB") //was what I thought it might be

Any help appreciated

Should you pass enum instead of string? https://developer.adobe.com/photoshop/uxp/2022/ps_reference/modules/constants/#changemode

I sort of gave up trying to get this to work but would like to see some code examples on how to do it using the API please as this would be great to help learn more.

const photoshop = require("photoshop");
photoshop.core.executeAsModal(() => {
  photoshop.app.activeDocument.changeMode(photoshop.constants.ChangeMode.RGB)
});

works fine for me

@simonhenke Excellent thankyou.
What would be nice is if the Docs showed examples like the one you have shown as is would help us novices learn quicker with less frustration :slight_smile: