Copy link to clipboard
Copied
I need help with the print possibilities in Photoshop.
When I have made a print, and found the ex. 20 colors to use, then I have named the colors.
Sometimes I give them names, in other situations they have numbers. However, I am looking for
a way to print my design, with the color palette showing, with the names of them belonging to each color.
Fingers crossed its possible and someone can help me 🙂 Thanx.
Copy link to clipboard
Copied
Are you talking about Spot Channels?
Copy link to clipboard
Copied
hmmm, I don´t know 🙂 perhaps.
I need the colors I am using in my design, to be printet out on a .pdf along with the design I have made.
Like the image att. below, were the colors from the center design is shown individually with color numbers below each.
I hope this makes sense 🙂
Copy link to clipboard
Copied
Please post images on the Forum in a browser, but don’t include them in email-replies.
What is the print process you are working for?
Copy link to clipboard
Copied
ok, how do I post the images on the Forum in a browser ?
I used the drag&drop in my last reply, does it not work ?
The process I am looking for is, when I have made my design - I press print, and I need Photoshop to collect some of the info in the design automatically.
is there a way to make Photoshop automatically use the colors I have used in the design, and
put them at the top of the print page, with the color numbers to go with each color ?
And also put a logo on the page, and a text field for me to fill in each time for different clients ect.
thank you for your time 🙂
Copy link to clipboard
Copied
Please use the »Insert Photos« button.
I don’t seem to understand what you are trying to do.
What is the image’s Color Mode? Are there Spot Channels or not?
Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Channels, Options Bar, …) visible?
When you write »the colors I have used in the design« what does that mean exactly?
Are there only pixels of a limited number of colors without any graduation, soft edges, …?
Copy link to clipboard
Copied
Ok, I got the image att. now 🙂
This is roughly what I am looking for, I only use pixel based designs, so graduations and soft edges are not so soft, each color has to be easily separeted.
So the design image in the center below, have only the 6 colors shown above. And the colors shown above also
have the color numbers below each one. Is this somehow possible ?
Copy link to clipboard
Copied
What do the numbers represent? The RGB-numbers, Pantone Colors, …?
You might be mistaken with regard to »I only use pixel based designs, so graduations and soft edges are not so soft, each color has to be easily separeted«
The Color regions seems to have anti-aliased edges so there are not just six colors but many pixels of different color values.
Such a design would seem to be a mediocre fit for Photoshop and Illustrator might be more appropriate depending on the output needs.
Again:
What is the print process you are working for? Screen printing, offset, …, how many actual printing colors, …?
Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Channels, Options Bar, …) visible?
Copy link to clipboard
Copied
The color numbers, are very basic, if I have a specific red color, I just give it a number myself, it is not the recipy (RGB ) or anything like that. I could name the red color "hot chili" as long as it would show up on the .pdf print made from Photoshop, or Illustrator.
I make designs for embroidery, and each strand of yarn in the embroidery, is a pixel in the design. therefore it will look just as pixilated when I zoom into a design, and the colors are very separeted, no blending.
I use a maximum of 14 colors in each design. But I need the pixilation, to position my stitches.
The att. is just quick example of what I want from the .pdfs I send out to customers, and for this illustrative purpose, I have just set it up in Illustrator.
However, I would like to make this sort of print from Photoshop, preferably so it automatically takes the colors used in my design, and makes circkles ( or any other shape ) above the design, with each color name under it.
But is it at all possible ?
Copy link to clipboard
Copied
I forgot to write, the colors are all indexed.
Copy link to clipboard
Copied
Thanks.
Creating a copy of a file with color swatches with names would likely at the very least take a Script.
Evaluating the Color Table of an Indexed Color Image should be possible, if I remember correctly, but how you get from that to the intended names I am not sure.
Copy link to clipboard
Copied
Aha, so there is hope for my inquiry 🙂
What does it mean to "at least take a script."? is it a software programming thing ?
Copy link to clipboard
Copied
Actions don’t suffice for this, so JavaScript would be the alternative.
Copy link to clipboard
Copied
An example of something similar for an RGB-image.
Copy link to clipboard
Copied
Could you please provide sample files (one as is and the intended resulting file)?
Copy link to clipboard
Copied
Well, in principle this may work.
// get indexed color values of gif-image and create swatches in an rgb copy;
// thanks to peter gun, xbytor and r-bin;
// 2024, use it at your own risk;
if (app.documents.length > 0) {
var myDocument = activeDocument;
if (myDocument.mode == DocumentMode.INDEXEDCOLOR) {
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var filePath = myDocument.fullName;
// get gif color table;
readFromFile = function(fptr) {
var file = convertFptr(fptr);
file.open("r") || Error.runtimeError(9002, "Unable to open input file \"" +
file + "\".\r" + file.error);
file.encoding = 'BINARY';
var str = '';
str = file.read(file.length);
file.close();
return str;
};
convertFptr = function(fptr) {
var f;
if (fptr.constructor == String) {
f = File(fptr);
} else if (fptr instanceof File || fptr instanceof Folder) {
f = fptr;
} else {
throw "Bad file \"" + fptr + "\" specified.";
}
return f;
};
readByteHex = function(s) {
function hexDigit(d) {
if (d < 10) return d.toString();
d -= 10;
return String.fromCharCode('A'.charCodeAt(0) + d);
}
var str = '';
s = s.toString();
var ch = s.charCodeAt(0xA);
str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
return str;
};
// hex to bin conversion
Math.base = function(n, to, from) {
return parseInt(n, from || 10).toString(to);
};
//load test image
var img = readFromFile(activeDocument.fullName);
hex = readByteHex(img); // hex string of the 0xA byte
bin = Math.base(hex,2,16); // binary string of the 0xA byte
tableSize = bin.slice(5,8); // Get the 3 bit info that defines size of the ct
switch(tableSize)
{
case '000': // 6 bytes table
tablSize = 2
break;
case '001': // 12 bytes table
tablSize = 4
break;
case '010': // 24 bytes table
tablSize = 8
break;
case '011': // 48 bytes table
tablSize = 16
break;
case '100': // 96 bytes table
tablSize = 32
break;
case '101': // 192 bytes table
tablSize = 64
break;
case '110': // 384 bytes table
tablSize = 128
break;
case '111': // 768 bytes table
tablSize = 256
break;
};
getTbColor = function(s, color) {
function hexDigit(d) {
if (d < 10) return d.toString();
d -= 10;
return String.fromCharCode('A'.charCodeAt(0) + d);
}
var tbStart = 0xD; // Start of the color table byte location
var colStrSz = 3; // Constant -> RGB
var str = '';
s = s.toString();
for (var i = tbStart+(colStrSz*color); i < tbStart+(colStrSz*color)+colStrSz; i++) {
var ch = s.charCodeAt(i);
str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
}
return str;
};
var colorHex = [];
importColors = function (){
for (i=0; i< tablSize; i++){ // number of colors
colorHex[i] = getTbColor(img, i);
}
};
importColors();
function unique(arrayName){
var newArray=new Array();
label:for(var i=0; i<arrayName.length;i++ ){
for(var j=0; j<newArray.length;j++ ){
if(newArray[j]==arrayName[i])
continue label;
}
newArray[newArray.length] = arrayName[i];
}
return newArray;
};
colorHex = unique(colorHex);
//alert (colorHex.length+"\n"+colorHex.join("\n"));
////////////////////////////////////
var theCopy = myDocument.duplicate();
// convert to rgb;
var desc5 = new ActionDescriptor();
desc5.putClass( stringIDToTypeID( "to" ), stringIDToTypeID( "RGBColorMode" ) );
executeAction( stringIDToTypeID( "convertMode" ), desc5, DialogModes.NO );
// extend canvas;
resetForeAndBackground ();
var numberPerLine = 7;
var theDist = 20;
var fromEdge = 20;
var theSide = (Number(theCopy.width)-(fromEdge*2)-theDist*(numberPerLine-1))/(numberPerLine);
var theY = fromEdge;
var theX = fromEdge-theSide-theDist;
theCopy.resizeCanvas(theCopy.width, theCopy.height+((theSide+theDist)*(Math.ceil(colorHex.length/numberPerLine))+fromEdge), AnchorPosition.BOTTOMCENTER);
// create shape layers;
for (var b = 0; b < colorHex.length; b++) {
var theX = theX+theSide+theDist;
var theWidth = theX+theSide+theDist;
if (theX+theSide > myDocument.width) {
var theWidth = theX;
theX = fromEdge+theDist-theDist;
theY = theY+theSide+theDist;
};
// thanks to r-bin;
var t = colorHex[b];
(foreColor = new SolidColor).rgb.red = parseInt(t.substr(0,2),16);
foreColor.rgb.green = parseInt(t.substr(2,2),16);
foreColor.rgb.blue = parseInt(t.substr(-2),16);
ellipseShapeLayer ([Math.round(theX), Math.round(theY), Math.round(theX+theSide), Math.round(theY+theSide)], [foreColor.rgb.red, foreColor.rgb.green, foreColor.rgb.blue], 0, [0,0,0])
createTextLayer (colorHex[b], [Math.round(theX+theSide/2), Math.round(theY+theSide+theDist)], theCopy.resolution)
};
theCopy.activeLayer = theCopy.layers[theCopy.layers.length-1];
////////////////////////////////////
app.preferences.rulerUnits = originalRulerUnits;
};
};
////// reset fore- and background color //////
function resetForeAndBackground () {
var desc2 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty( charIDToTypeID( "Clr " ), charIDToTypeID( "Clrs" ) );
desc2.putReference( charIDToTypeID( "null" ), ref1 );
executeAction( charIDToTypeID( "Rset" ), desc2, DialogModes.NO );
};
////// create ellipse shape layer //////
function ellipseShapeLayer (theBounds, theColor, strokeWidth, strokeColor) {
try {
// Make outer oval
var idPxl = charIDToTypeID( "#Pxl" );
var idPnt = charIDToTypeID( "#Pnt" );
var idClr = charIDToTypeID( "Clr " );
var idRd = charIDToTypeID( "Rd " );
var idGrn = charIDToTypeID( "Grn " );
var idBl = charIDToTypeID( "Bl " );
var idRGBC = charIDToTypeID( "RGBC" );
var idcontentLayer = stringIDToTypeID( "contentLayer" );
var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
var idstrokeStyle = stringIDToTypeID( "strokeStyle" );
var idstrokeStyleLineAlignment = stringIDToTypeID( "strokeStyleLineAlignment" );
var idstrokeStyleLineJoinType = stringIDToTypeID( "strokeStyleLineJoinType" );
var desc41 = new ActionDescriptor();
var ref12 = new ActionReference();
ref12.putClass( idcontentLayer );
desc41.putReference( charIDToTypeID( "null" ), ref12 );
var desc42 = new ActionDescriptor();
var desc43 = new ActionDescriptor();
if (theColor != false) {
var desc44 = new ActionDescriptor();
desc44.putDouble( idRd, theColor[0] );
desc44.putDouble( idGrn, theColor[1] );
desc44.putDouble( idBl, theColor[2] );
desc43.putObject( idClr, idRGBC, desc44 );
};
desc42.putObject( charIDToTypeID( "Type" ), idsolidColorLayer, desc43 );
var desc45 = new ActionDescriptor();
desc45.putUnitDouble( charIDToTypeID( "Top " ), idPxl, theBounds[1] );
desc45.putUnitDouble( charIDToTypeID( "Left" ), idPxl, theBounds[0] );
desc45.putUnitDouble( charIDToTypeID( "Btom" ), idPxl, theBounds[3] );
desc45.putUnitDouble( charIDToTypeID( "Rght" ), idPxl, theBounds[2] );
desc42.putObject( charIDToTypeID( "Shp " ), charIDToTypeID( "Elps" ), desc45 );
var desc46 = new ActionDescriptor();
desc46.putInteger( stringIDToTypeID( "strokeStyleVersion" ), 2 );
if (strokeWidth == 0) {desc46.putBoolean( stringIDToTypeID( "strokeEnabled" ), false )}
else {desc46.putBoolean( stringIDToTypeID( "strokeEnabled" ), true )};
if (theColor == false) {desc46.putBoolean( stringIDToTypeID( "fillEnabled" ), false )}
else {{desc46.putBoolean( stringIDToTypeID( "fillEnabled" ), true )}};
desc46.putUnitDouble( stringIDToTypeID( "strokeStyleLineWidth" ), idPnt, strokeWidth );
desc46.putUnitDouble( stringIDToTypeID( "strokeStyleLineDashOffset" ), idPnt, 0.000000 );
desc46.putDouble( stringIDToTypeID( "strokeStyleMiterLimit" ), 100.000000 );
desc46.putEnumerated( stringIDToTypeID( "strokeStyleLineCapType" ), stringIDToTypeID( "strokeStyleButtCap" ), stringIDToTypeID( "strokeStyleButtCap" ) );
desc46.putEnumerated( idstrokeStyleLineJoinType, idstrokeStyleLineJoinType, stringIDToTypeID( "strokeStyleMiterJoin" ) );
desc46.putEnumerated( idstrokeStyleLineAlignment, idstrokeStyleLineAlignment, stringIDToTypeID( "strokeStyleAlignCenter" ) );//strokeStyleAlignOutside
desc46.putBoolean( stringIDToTypeID( "strokeStyleScaleLock" ), false );
desc46.putBoolean( stringIDToTypeID( "strokeStyleStrokeAdjust" ), false );
var list3 = new ActionList();
desc46.putList( stringIDToTypeID( "strokeStyleLineDashSet" ), list3 );
desc46.putEnumerated( stringIDToTypeID( "strokeStyleBlendMode" ), charIDToTypeID( "BlnM" ), charIDToTypeID( "Nrml" ) );
desc46.putUnitDouble( stringIDToTypeID( "strokeStyleOpacity" ), charIDToTypeID( "#Prc" ), 100.000000 );
var desc47 = new ActionDescriptor();
var desc48 = new ActionDescriptor();
desc48.putDouble( idRd, strokeColor[0] );
desc48.putDouble( idGrn, strokeColor[1] );
desc48.putDouble( idBl, strokeColor[2] );
desc47.putObject( idClr, idRGBC, desc48 );
desc46.putObject( stringIDToTypeID( "strokeStyleContent" ), idsolidColorLayer, desc47 );
desc46.putDouble( stringIDToTypeID( "strokeStyleResolution" ), 300 );
desc42.putObject( idstrokeStyle, idstrokeStyle, desc46 );
desc41.putObject( charIDToTypeID( "Usng" ), idcontentLayer, desc42 );
executeAction( charIDToTypeID( "Mk " ), desc41, DialogModes.NO );
} catch (e) {alert ("fail")}
};
////// add text layer //////
function createTextLayer (thisText, thePoint, res) {
var docRef = activeDocument;
var myLayerRef = docRef.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
myLayerRef.name = thisText;
var myTextRef = myLayerRef.textItem;
myTextRef.kind = TextType.POINTTEXT;
myTextRef.size = 24 * 72 / res;
myTextRef.font = "Arial";
myTextRef.justification = Justification.CENTER;
//Set text colour in RGB values
var newColor = new SolidColor();
newColor.rgb.red = 0;
newColor.rgb.green = 0;
newColor.rgb.blue = 0;
myTextRef.color = newColor;
// set the position;
myTextRef.position = [thePoint[0], thePoint[1]];
//myTextRef.position = [thePoint[0] * 72 / res, thePoint[1] * 72 / res];
myLayerRef.blendMode = BlendMode.NORMAL;
myLayerRef.opacity = 100;
myTextRef.useAutoLeading = false;
myTextRef.leading = 0;
myTextRef.contents = thisText;
return docRef.activeLayer
};
updated 2024-04-09
Copy link to clipboard
Copied
Have you tested the Script?
Copy link to clipboard
Copied
Hi again, not yet, I don´t know how to implement the script you have att.
Can you give me a short guide ?
Copy link to clipboard
Copied
There seems to have been a mistake of mine, so I updated the code and it should work with an open gif now.
Save the code as a txt-file, change the extension to .jsx and copy it into Photoshop’s Presets/Scripts-Folder; after restarting Photoshop it should be available under File > Scripts and can be assigned a Shortcut or used in an Action.