Creating lab colour swatches in illustrator using csv text

HI

first post on here, go easy on me..

Is there any way of automating the import of lab colour references and colour labels from excel / csv into ase / illustrator, rather than manually entering them into the swatch palette in illy? Am struggling with a range of in gamut colours that I want to bring into illy and set up an ase to use across adobe products. I have limited scripting experience but am thinking the answer lies in writing a script of some sort.

Any advice would be much appreciated and many thanks in advance
 
I looked around the Adobe forums and there are some scripts for RGB or CMYK based input, however I did not see any for Lab (not sure how hard it is to change the scripts). As an .ASE file is cross-application, it should not really matter if the script was run in Illustrator, InDesign or Photoshop as once the swatch exchange file is generated it can be imported into the other apps as necessary.


Stephen Marsh
 
Hello William,

Yes. Totally possible. Are you using a Mac or a PC?

Tim-Ellis, I'm on a mac.. Do you have any further info? Anything would be really helpful thanks..

Stephen, yes that's what I've seen too, only rgb and cmyk.. I have tried to change scripts to lab but I think I need more understanding on scripting before I start changing such functions.. I downloaded adobe's scripting guide for Mac last night which as you say covers cmyk and rgb but not lab. I may be able to work with rgb but would rather look for something where it is a pure conversion and not rely on further formulae in excel to convert to rgb.

thanks to both of you for responses.
 
Last edited:
Hello William,

Phew. Mac makes it easier for me

I'm just debugging the script. Should be ready in a few hours
 
Hello William,

Ok. All done. I had a look at how to edit an .ASE file but it's WAY too complex for me.

Here is a ZIP file with the Spreadsheet Template for the values and the Apple Script to make it work.

I had to set an upper limit so it will create 200 swatches, let me know if you need more than that.

Unzip the file somewhere easy to find. Open the Script with Script Editor and press the RUN icon.


The Script will ...
  • Create a new blank AI document and then delete all the default swatches (to avoid duplicate names)
    -
  • It will ask you to select the Excel Spreadsheet with all the LAB values and Swatch Names you have decided upon (no duplicate names please)
    -
  • The script will ask you how many rows you want it to process. Just enter the number of rows you have created in the spreadsheet (my Excel scripting is not good enough to detect where you have stopped filling in rows)
    -
  • The script will then create the LAB swatches in the AI doc and tell you when its DONE. Just click OK to finish.
    -
  • Once done you save your Swatches as an ASE Library and share them between users and applications.



Please remember
  • AI does not hold LAB values with a decimal place. 72.14 will become just 72 in Illustrator.
    -
  • There is only a little error checking inside the script at this point so you might get an error or two the first time.


How does it work?


Yes - lots of scripts for RGB and CMYK swatches out there. I couldn't find anything referring to LAB so I took a lucky guess and it worked.



tell application "Adobe Illustrator"



set SpotColor to {l:50, a:25, b:25}

make new spot in document 1 with properties {name:"Swatch Name", color type:spot color, color:SpotColor}



end tell




What do I do if it doesn't work?

Just post the problem here. Good luck.
 

Attachments

  • create LAB swatches.zip
    53.5 KB · Views: 524
Last edited:
Tim-Ellis, this works brilliantly, thanks ever so much for this, saves me so much time. I do have a higher number of swatches - potentially could be 1500. Is this an easy fix?

You are a legend for helping me with this, thanks again
 
Hello William,

You are very welcome. :)

You can easily edit the script yourself
  • Open the script
    -
  • Press {command} + F to open the FIND and REPLACE menu.
    -
    • Find 200
      -
    • Replace with 1500
You will see there are just 3 matches (one for the maths in the script and two are just for the dialog boxes)

I have no idea what the maximum number of swatches you can have in a document or an .ASE library are

Best of luck.
 
Again, this helps me massively, and i have everything I need. TIm, you've saved me so much time with your help, I can't thank you enough, brilliant work,

Will
 
HI all

Another issue that I now have is I want to automatically fill a number of individual rectangles on an illustrator document with all the swatches from the library - in grid formation.

Does anyone know if there is a script / action within illustrator that would do such a thing? I can do this manually but am trying to perfect a process with the least manual interaction (I have the tendancy to make human errors lol).

I thought this would be a relatively straightforward action based function within illustrator but had a bit of a play this am and couldnt nail it. Looking at the preset scripts on this within illustrator they seem to be almost there - again my limited scripting talent has brought me here.

Any help / guidance would be massively appreciated, even if its just a script or action that does a similar thing, I can have a go at editing it myself.

I am still reeling from the amazing help I had on my last request, and once again thanks in advance and any help this great community can offer..
 
What do you intend to do with the Lab based colour swatch layout? Print it out? Are you working with PDF files? Are you using a RIP/DFE at the printer?


Stephen Marsh
 
Hello William,

Lol... Well, you seem to have lucked out on your first post. It doesn't usually work this well.

Stephen makes some good points here. You need to consider what happens next to your document. If it's just a handy reference for you to keep in the office then that's one thing. If you are planning a global advertising campaign, that's different.

You have a number of options open to you for this.

First take a look at the 'Render Swatch Legend' script from the amazing John Wundes

​​​​​​http://www.wundes.com/JS4AI/


They were written for CS4 bit I've yet to find one that doesn't work. These are java scripts so they work for both PC and Mac but you need to access them from inside illustrator (File >Scripts) or {command} and F12.
​
If you have never visited John's page please do. It's incredible what he has there. You won't be disappointed.
 
Last edited:
HI Stephen. Yes output proof and press sheet. Then compare to lab of swatch / proof to press delta es. Output to pdf to then use in dfe.
 
Great stuff Tim, will check this out tomorrow. Looks like a good site too. Thanks once again for your help. Will keep you posted how I get on
 
HI Stephen. Yes output proof and press sheet. Then compare to lab of swatch / proof to press delta es. Output to pdf to then use in dfe.

Ah, that may be an issue…

Is the DFE pickup up the Lab values from the spots and then converting them on the fly to the final device space using a spot colour lookup table of some sort?

Is the DFE APPE based?

At one point in time, the Adobe PDF Print Engine (APPE) licensed from Adobe for use in various RIP/DFE only supported a maximum of 27 spot colours. At a later point I think it was updated to around 37 spots. I think that the PDF specification has a similar issue on the amount of spots that are displayed in the list of plates in the PDF file in Acrobat Pro output preview (although the file can contain more).

I may be worried about nothing, however there could be an issue with converting many spots. Not sure if the old CPSI RIP also had limitations or not.

If you could convert all of the spots to final device CMYK and then run the chart without colour management that would be an option.

A real separated press job would not require 27 spots to be accurately handled – however running a spot colour test chart is a different case, it may not be producing plates but all of the colour patches still require correct colour management. It is no good if only first 27-37 spots are correctly handled and the remaining are not!


Adobe’s Dov, Leonard – are you out there?




Stephen Marsh
 
Last edited:
Thank you Stephen. I'd forgotten that.

Hello William,

I know that this is your first post so I just want to manage your expectations here. Usually when we post stuff, not much happens. It's not routine for people like Dov Isaacs, principal scientist at Adobe Systems to roll up every time you ask a question. These are busy guys. They have a lot on their plate.

If you ever really need to catch Dov's attention, post something stupid like "Hey, what's so wrong about editing a PDF in Illustrator?"

Do that, and he will appear in a matter of moments :)
 
HI Stephen

Good point, all the delta es on my samples were good before when I did the process manually - over 100 samples on a pdf. I have yet to repeat the entire test using Tim-ellis' script, have just checked the script itself not the results from a pdf. Will bear the points you have made in mind. Thanks for the detailed response.
​
and thanks for the heads up Tim-Ellis , I may try and get Dov's attention in the future lol!
 
Last edited:
I just tried with the latest version of CGS ORIS Color Tuner // Web using the APPE engine.

I created a PDF with 50 named spots.

I then created a spot colour lookup defined as solid cyan.

The first 30 spots in the test file were correctly colour managed to cyan.

The last 20 spots were not colour managed by the spot colour lookup table.

Now as the source was setup as Lab spots, this may not be a problem! So if you know that your RIP/DFE can correctly render from a Lab based spot to final device space, then you are all good to go. Otherwise you may have to convert the spots to final proofing device CMYK (not press simulation CMYK) first and run the chart with no colour management.


Regards,

Stephen Marsh


lookup.jpg
 
Hello William,

First take a look at the 'Render Swatch Legend' script from the amazing John Wundes

​​​​​​http://www.wundes.com/JS4AI/


They were written for CS4 bit I've yet to find one that doesn't work. These are java scripts so they work for both PC and Mac but you need to access them from inside illustrator (File >Scripts) or {command} and F12.
​
If you have never visited John's page please do. It's incredible what he has there. You won't be disappointed.

Tim-Ellis, I have had a look at this, Render Swatch Legend works fantastic, the resulting illustrator puts in the colour blocks accurately and on output to pdf shows me it keeps the colours as LAB. A small annoyance is that the text it adds over each block has the cmyk values and not the LAB values - and I am not sure how to change this. Have looked through the script and there are many references to cmyk and not sure which one to change to make the text appear as lab. Not sure if you have any suggestions on this, no worries if not, I can work around this as its just the naming convention - everything else works a treat. Thanks once again Tim-Ellis.
 

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top