Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Change DocumentColorSpace to RGB via Javascript

Explorer ,
May 06, 2020 May 06, 2020

Hi,

I have a Javascript Problem. I created a script that exports an vector icon in different formats, for print (eps and ai) and for web (png and svg). My Original DocumentColorSpace is CMYK.

 

When I export the web files the colors deviate from what I defined in the file, because the DocumentColorSpace is still CMYK and not RGB. I can only change it if I create a new document. Is there another way?

 

var grey = new RGBColor();
grey.red = 124;
grey.green = 131;
grey.blue = 132;

var param = bks.name.split('.');
realDocName = param[0];
file = preffix+filepreffix+realDocName+'_grau'+suffix;
folder = preffix+foldername;
var f = new Folder(bks.path + "/" + folder);
if (!f.exists)
f.create();
var saveName = new File ( f + "/" + file );
bks.exportFile(saveName, type, optionsSVG);
bks.close(SaveOptions.DONOTSAVECHANGES);
bks = null;
app.open (fullDocName);
bks = app.activeDocument;
TOPICS
Scripting
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 06, 2020 May 06, 2020

Hi,

You can change the document color space from CMYK to RGB using following command

app.executeMenuCommand('doc-color-rgb');

 

and from RGB to CMYK using 

app.executeMenuCommand('doc-color-cmyk');

 

Let us know if this helps you.

Thanks

Translate
Adobe
Community Expert ,
May 06, 2020 May 06, 2020

Hi,

You can change the document color space from CMYK to RGB using following command

app.executeMenuCommand('doc-color-rgb');

 

and from RGB to CMYK using 

app.executeMenuCommand('doc-color-cmyk');

 

Let us know if this helps you.

Thanks

Best regards
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2020 Jun 07, 2020
LATEST

Thank you so much. It worked like a charm.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines