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

Script Convert - Gray to CMYK

Contributor ,
Oct 09, 2015 Oct 09, 2015

Copy link to clipboard

Copied

How do I convert a grayscale color item to CMYK, with k = 100% with overprint?

Screen Shot 2015-10-09 at 2.42.31 PM.pngScreen Shot 2015-10-09 at 2.42.39 PM.png

Thanks for helping!

TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

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
Adobe
Contributor ,
Oct 09, 2015 Oct 09, 2015

Copy link to clipboard

Copied

If you can apply overprint in grayscale mode (k100). It would be helpful!

Votes

Translate

Translate

Report

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
Community Expert ,
Oct 09, 2015 Oct 09, 2015

Copy link to clipboard

Copied

Convert and apply overprint sample:

if (app.selection[0].fillColor.gray===100) {

  cmyk = new CMYKColor;

  cmyk.cyan = 0;

  cmyk.magenta = 0;

  cmyk.yellow = 0;

  cmyk.black = 100;

  app.selection[0].fillColor = cmyk;

  app.selection[0].fillOverprint = true;

  }

More simple...

if (app.selection[0].fillColor.gray===100) app.selection[0].fillOverprint = true;

Votes

Translate

Translate

Report

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
Contributor ,
Oct 14, 2015 Oct 14, 2015

Copy link to clipboard

Copied

Thanks so much!

Votes

Translate

Translate

Report

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
Participant ,
Oct 10, 2015 Oct 10, 2015

Copy link to clipboard

Copied

function grayToCMYK(color){

    if(color.typename !== 'GrayColor') return false;

    var CMYK = new CMYKColor(),

        convertColor = app.convertSampleColor(ImageColorSpace.GrayScale, [color.gray], ImageColorSpace.CMYK, ColorConvertPurpose.defaultpurpose);

        CMYK.cyan = convertColor[0];

        CMYK.magenta = convertColor[1];

        CMYK.yellow = convertColor[2];

        CMYK.black = convertColor[3];

    return CMYK;

}

selection[0].fillColor = grayToCMYK( selection[0].fillColor );

alert( 'Color type: ' + selection[0].fillColor.typename + '\nCyan: ' + selection[0].fillColor.cyan + '\nMagenta: ' + selection[0].fillColor.magenta +'\nYellow: ' + selection[0].fillColor.yellow + '\nBlack: ' + selection[0].fillColor.black );

Votes

Translate

Translate

Report

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
Community Expert ,
Oct 10, 2015 Oct 10, 2015

Copy link to clipboard

Copied

More simple:

app.executeMenuCommand("Colors8");

Votes

Translate

Translate

Report

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
Contributor ,
Oct 14, 2015 Oct 14, 2015

Copy link to clipboard

Copied

LATEST

Thanks!

Votes

Translate

Translate

Report

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
Community Expert ,
Oct 10, 2015 Oct 10, 2015

Copy link to clipboard

Copied

I am guessing that it will never be this simple, the value could be a stroke or a fill and stroke at the same time, not just a fill only. Then there are tints of gray and not just solids…

Votes

Translate

Translate

Report

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
Guide ,
Oct 11, 2015 Oct 11, 2015

Copy link to clipboard

Copied

Ten A's solution will convert all GrayColor objects that are selected to CMYKColor.

this work for fills and strokes.

GrayColor does not have Tint, nor does CMYK. Tint is the domain of Spot colours.

Votes

Translate

Translate

Report

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
Community Expert ,
Oct 11, 2015 Oct 11, 2015

Copy link to clipboard

Copied

Thank you for the clarification Qwertyfly…

Perhaps this is a CS6 thing, however I have found that:

Post #2 from Ten A – “Convert and apply overprint sample” only converts solid 100% fills of grayscale to CMYK, lesser “tints” and or solid strokes are not converted. From the same post “More simple…” single line of code method does not change any value.

I have just tried Post #4 from Ten A – “More simple:” which does work on all selected fills or strokes!

Thanks Ten A and Qwertyfly!

Votes

Translate

Translate

Report

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
Guide ,
Oct 11, 2015 Oct 11, 2015

Copy link to clipboard

Copied

I should have clarified,

I was referring to Ten A's "More Simple" post.

Votes

Translate

Translate

Report

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