Color Swatch contact sheet from palette colors

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: Tom, Kukurykus

garek007

Color Swatch contact sheet from palette colors

Post by garek007 »

Ok,

So I've modified Xbytor's ColorBook files, and Larry Ligon's Make Swatches file to get a this:

A set of scripts that will read a color book (*.atn) output a comma delimited file, read that file back in.

It's tricky because first you have to use X's script to make a palette of colors into a text file. Then you need excel or equivalent to create a csv file. Then you use ColorChart1 to read that excel file back in.

Seem pointless? well it is right now. I'm going to add some code to it that will allow each color read to be 'stamped' onto a document making a Color Chart of all colors in a palette. That will come later.

For now, I'm hoping the experts can look at this code, give some advice, and tell me why it's not reading the first line. I'll post back when I have more. Thanks for the support X and Larry.

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

xbytor

Color Swatch contact sheet from palette colors

Post by xbytor »

I'll try to take a look at this later today or early tomorrow.

Congrats on getting this turned around so quickly.
garek007

Color Swatch contact sheet from palette colors

Post by garek007 »

Thanks, I've got even more now, I've got it working exactly as I want, my problem is trying to figure out why I'm getting LAB color out of your script instead of RGB which is what I prefer.
garek007

Color Swatch contact sheet from palette colors

Post by garek007 »

I'm now uploading another iteration so that people can see, and give feedback. This file will actually build the sheets and make swatches using a comma delimited file.

It works well if you provide it with proper color values. I went to this site

http://jksalescompany.com/ken/pantone_to_rgb.html

and copied pasted those values into a csv and that worked fine.

When trying to get values from Xbytor's color book.js I had trouble because the values are not rgb values but something else and I can't figure out how to get rgb values out of his script.

Working with him, I think we can have one script that reads a color palette, saves some csv files and kicks off another script that reads them in and makes swatches.

It works fine now, but it's a two step process. I also plan to add a menu so you can set up your document size. Currently it defaults to 24x36 150dpi.
xbytor

Color Swatch contact sheet from palette colors

Post by xbytor »

Here's a rev of ColorBook demo that spits out a csv file that should be suitable for Larry's script.

Note the use of SolidColor to convert from Lab and CMYK to RGB...

I also added some code to adjust any localization strings in the color names.

ciao,
-X
garek007

Color Swatch contact sheet from palette colors

Post by garek007 »

Thanks X,

I looked at your script but had trouble telling where the conversion happened. Also, are you sure this converts to RGB? I compared the output values with those of yesterday (from your original ColorBook.js) and found that they were exactly the same. The only explanation(s) for this are that either the script is still outputting lab color values or I was getting RGB values yesterday and didn't realized it.

The reason I didn't believe I was getting RGB values is because after making a swatch sheet I compared the colors and they didn't seem to match the pantone palette. The other reason for this is that maybe your output list isn't in the order of the palette. Is it in order?
xbytor

Color Swatch contact sheet from palette colors

Post by xbytor »

To convert from one color to another, try the following:

Code: Select allvar lc = new LabColor();
lc.l = 0.0; lc.a = 100.0; lc.b = 75.0

var sc = new SolidColor();
sc.lab = lc;

var rgb = sc.rgb;

This works between other color modes as well.

The colors are in order.

In Pantone pastel coated, the first color is "PANTONE Yellow 0131 C". Its Lab value is { 238, 123, 159 } as computed by the ColorBookDemo script. Its RGB value is { 247,0,7 } as computed by the CSwatch script I just posted.

The L value is supposed to range from 0 to 100.0 while the a and b values from -128.0 to 127.0 so it appears as if there is a slight problem somewhere.

I'll take a look at it in more detail tonight or tomorrow morning.

ciao,
-X
xbytor

Color Swatch contact sheet from palette colors

Post by xbytor »

Here's the fix...

Code: Select allColorBook.prototype.readColorBytes = function(str) {
  var self = this;
  var wlen = (self.colorType == ColorBook.CMYK_TYPE) ? 4 : 3;
  var cbytes = [];
  for (var i = 0; i < wlen; i++) {
    cbytes.push(str.readByte());
  }

  if (self.colorType == ColorBook.LAB_TYPE) {
    cbytes[0]  = Math.round(100 * cbytes[0] / 256)
    cbytes[1] -= 128;
    cbytes[2] -= 128;
  }

  return cbytes;
};
garek007

Color Swatch contact sheet from palette colors

Post by garek007 »

Ok thanks. I don't like to doubt you, but after reading that LAB values aren't like RGB values I was confused. Thanks for checking into it.
garek007

Color Swatch contact sheet from palette colors

Post by garek007 »

X -

Sorry to bother you, yet again, but seeing as you've put all this work into helping me I want to be able to give a finished script back. For some reason I'm getting a log window but no CSV file. I used it yesterday and I swear it worked. It looks like it produces a logfile when there is no PS7, but I am using CS2.