Highlighted

Illustrator Javascript - Render Swatch Legend - LAB Colour Values Incorrect

Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Hi All!

So, a question regarding the failry well known fab Script written by John Wundes:

renderSwatchLegend.jsx 

I need to create a chart that specifies just the LAB values underneith the swatches that the script creates, but curiously, the LAB values that the script produces are always wrong - they're always out by a digit and I don't know why. 

 

If I double click the swatch in the swatch palette, the LAB value is correct/as it should be, it is just the text that the script produces and lays onto the artboard that is incorrect. Please see following image. Any ideas why this glitch is happening?

 

This glitch happens consistently on every single import - the lab value that the script generates onto the artboard is never the correct value. Help! 

 

Screenshot 2020-09-16 151903.jpg

 

 

 

 

 

 

 

TOPICS
Bug, Draw and design, Scripting, Third party plugins

Views

108

Likes

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

Illustrator Javascript - Render Swatch Legend - LAB Colour Values Incorrect

Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Hi All!

So, a question regarding the failry well known fab Script written by John Wundes:

renderSwatchLegend.jsx 

I need to create a chart that specifies just the LAB values underneith the swatches that the script creates, but curiously, the LAB values that the script produces are always wrong - they're always out by a digit and I don't know why. 

 

If I double click the swatch in the swatch palette, the LAB value is correct/as it should be, it is just the text that the script produces and lays onto the artboard that is incorrect. Please see following image. Any ideas why this glitch is happening?

 

This glitch happens consistently on every single import - the lab value that the script generates onto the artboard is never the correct value. Help! 

 

Screenshot 2020-09-16 151903.jpg

 

 

 

 

 

 

 

TOPICS
Bug, Draw and design, Scripting, Third party plugins

Views

109

Likes

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
Sep 16, 2020 0
Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

ALSO - I forgot to add, does anyone know what the G number is (below the LAB values?)

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

Most likely Gray scale on a 0-10 range.

Likes

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
Reply
Loading...
Sep 16, 2020 0
Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Thanks larry! 

 

Do you know if it is necessary to display this value along with LAB? (If I have to show LAB that is)

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

I don't think the script is correct in showing the Lab values.

It looks like it is showing the Lab values of the color when it is converted to CMYK.

Likes

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
Reply
Loading...
Sep 16, 2020 0
Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Argh! IF so, that is super frustrating. LAB values are the most accurate print values there are, so it's crucial they match. 

 

What is puzzling to me though, is that the script does any conversions at all - WHY???????

It should just be extracting the actual data from the swatch, so why is it changing numerical values at all? 

 

The actual swatch values are exacting, certainly from Pantones. So why does the script then start to ínterpret' them? Makes no sense at all. 

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

we don't have access to LAB values in the scripting API, that's the reason conversion was needed

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

An Book Color, Carlos, is that available in scripting?

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

The Scripting API recognizes Pantone Colors as SpotLAB, but when we dig down to get the actual color values we get either CMYK or RGB according to your Document Color Mode.

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

It comes down to rounding, decimals get lost from Pantone to CMYK (or RGB) then to LAB.

Likes

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
Reply
Loading...
Sep 16, 2020 0
Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

I’m not sure that is correct. Rounding would make sense if there were half values etc but this isn’t the case.

On every single imported swatch - I.e on every swatch the script runs through and presents on the art board, the values are always one digit more out, without fail. The L value often remains the same, but the A B Values are always off by one digit. This isn’t rounding, there’s something going wrong.

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

It is not rounding.

A Pantone color cannot be reproduced in CMYK, that's why it is a special mixed ink.

But Lab can describe any color we can see.

When you convert from Lab to CMYK you will lose color information

When you convert it back to Lab, you will never get the original values back.

Likes

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
Reply
Loading...
Sep 16, 2020 0
Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Thanks for the input, but I'm getting completely lost and baffled here. 

why is the script doing any conversions of anything? I'm not sure if I have explained the problem correctly here. 

I'll try br clearer. 

when the script runs, it is placing the swatch on the art board - this is absolutely fine, I can select that placed square of colour that the script creates and then open up its swatch values by double clicking the actual swatch in the swatches palette - the values are all correct, LAB values also. 

The problem is nothing to do with the swatch or the colour itself. 

the problem, is the text that the script is placing onto the swatch. The LAB value in the text in creates, does not match up with the lab value of the actual swatch. 

Something funky is happening with the script that is extrapolating the LAB value from the swatches, it is deleting digits and then creating the overlay text. There is nothing wrong with the color/swatch itself, just the overlaid text info. 

is that clearer? 

Likes

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
Reply
Loading...
Sep 16, 2020 0
Adobe Community Professional ,
Sep 16, 2020

Copy link to clipboard

Copied

it's been clear since the very start Nathan, what I'm trying to tell you is that the LAB values you see in the UI are not accessible to scripting. The Scripting API provides a conversion method, we get the values in CMYK or RGB then we convert them to LAB. That's where the rounding comes from.

Likes

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
Reply
Loading...
Sep 16, 2020 0
Explorer ,
Sep 16, 2020

Copy link to clipboard

Copied

Hi Carlos, yes sorry - all is clear now, I understand what is happening. 

I've never understood why Illustrator doesn't display LAB natively, but this is obviously why the script is needing to take the cmyk/RGB data and then produce the Lab value (That is slightly different). 

Makes sense to me now, thank you for explaining and repeating this to me. 

 

Likes

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
Reply
Loading...
Sep 16, 2020 0