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

Script Convert - Gray to CMYK

Contributor ,
Oct 09, 2015 Oct 09, 2015

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

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

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

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;

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

Thanks so much!

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

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 );

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

More simple:

app.executeMenuCommand("Colors8");

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

Thanks!

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

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…

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

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.

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

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!

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

I should have clarified,

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

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