# How To Convert To RGB

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-convert-to-rgb/4691>\
**Category:** UXP Plugin API\
**Created:** [May 17, 2022, 9:45pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-convert-to-rgb/4691 "2022-05-17T21:45:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IanBarber](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IanBarber](https://forums.creativeclouddeveloper.com/u/IanBarber)\
**Post date:** [May 17, 2022, 9:45pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-convert-to-rgb/4691/1 "2022-05-17T21:45:27Z")

</div>

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.

```auto
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.

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

```

Any help appreciated

---

<div class="post-metadata">

**Author:** ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)\
**Post date:** [May 17, 2022, 10:49pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-convert-to-rgb/4691/2 "2022-05-17T22:49:27Z")

</div>

Should you pass enum instead of string? [https://developer.adobe.com/photoshop/uxp/2022/ps\_reference/modules/constants/#changemode](https://developer.adobe.com/photoshop/uxp/2022/ps_reference/modules/constants/#changemode)

---

<div class="post-metadata">

**Author:** ![IanBarber](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IanBarber](https://forums.creativeclouddeveloper.com/u/IanBarber)\
**Post date:** [June 10, 2022, 6:57am UTC](https://forums.creativeclouddeveloper.com/t/how-to-convert-to-rgb/4691/3 "2022-06-10T06:57:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![simonhenke](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/simonhenke/32/957_2.png) [@simonhenke](https://forums.creativeclouddeveloper.com/u/simonhenke)\
**Post date:** [June 10, 2022, 11:08am UTC](https://forums.creativeclouddeveloper.com/t/how-to-convert-to-rgb/4691/4 "2022-06-10T11:08:44Z")

</div>

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

```

works fine for me

---

<div class="post-metadata">

**Author:** ![IanBarber](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IanBarber](https://forums.creativeclouddeveloper.com/u/IanBarber)\
**Post date:** [June 10, 2022, 11:29am UTC](https://forums.creativeclouddeveloper.com/t/how-to-convert-to-rgb/4691/5 "2022-06-10T11:29:45Z")

</div>

> [@simonhenke](#):
>
> ```auto
> const photoshop = require("photoshop");
> photoshop.core.executeAsModal(() => {
> photoshop.app.activeDocument.changeMode(photoshop.constants.ChangeMode.RGB)
> });
> 
> ```

@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 🙂
