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

Assigning Number to Color

Community Beginner ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

6ba79188a7eeaced11682e56d1060c6d.jpg

 

Is there anyway to assign a number to each color to print out a color by number sheet?

Views

680

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
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 03, 2021 Feb 03, 2021

Okay here's a script that you can try. There are some things you need to do. You need to enlarge the image using precent. I enlarged it 2400%, so that a one pixel square would be 24 px. In the script, you have to enter the hex values of the colors in the art work and the corosponding number that you want displayed. This script takes a long time to run, as it has to sample so many areas. So try it out on a small image first. Here is my test image:

pixel add numbers.jpg

#target photoshop
var doc = activeDocument;

var
...

Votes

Translate

Translate
Adobe
Community Expert ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

Image > Mode > Index Color, and then save the Color Table as an .ACT file. An .ACT file is just a series of 256 three-byte values [RGB] . You can then load this into your Swatches panel. You could construct a document with each swatch to print out, or maybe a script to do it if you had a lot of them.

Votes

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
community guidelines
Community Beginner ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

Would this allow me to replace the colors with numbers? I created a 5 color table and saved it.

Votes

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
community guidelines
Community Expert ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

Just to be clear, are you looking to replace each block of color within the image with a number? Are these numbers also to appear within a table along with the appropriate color?

Votes

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
community guidelines
Community Beginner ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

I would like to have just the numbers. I would like to make print out for kids to color by number having the images appear as they go

Votes

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
community guidelines
Community Beginner ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

I would like to have just the numbers. I would like to make print out for kids to color by number having the images appear as they go.

Votes

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
community guidelines
Community Expert ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

Would these all be pixel art? Would you be marking every pixel cell, or just contiguous areas?

Votes

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
community guidelines
Community Beginner ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

Yes they are all pixel art. Prefer to have all cells individually marked becaus some of the pictures alternate color pretty frequently.

Votes

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
community guidelines
Community Expert ,
Feb 02, 2021 Feb 02, 2021

Copy link to clipboard

Copied

It could be done with a script that reads each color square and references the color against a value list.

Votes

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
community guidelines
Community Beginner ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

Where can I read up on doing this? or even pay to have it done?

Votes

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
community guidelines
Community Expert ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

I'm seeing about how to write a script for it. I had to redraw your image, as it had too much jpg artifacts. What needs to be done is to have the lines a color that isn't used in the art. Is there a final size for the cells, as the script need to make a step for each cell size, including the line width to measure the color and place the text. 

Votes

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
community guidelines
Community Beginner ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

I can provide an image made in photoshop (PNG file) if you prefer. On photoshop the pixels are seperated but, there is no visible grid.

 

Final size for cells is not imporatant... I think. Can it not be "blown up" later as a print?

Votes

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
community guidelines
Community Expert ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

Yes, a png would be better, maybe. without the grid line there will be numbers in the background color also. Maybe you want that. For the script to work you have to be consistant with the size of cells, or it would be difficult to have a script tell what the size of a cell it and where to place the number, and also have the number legible.

Votes

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
community guidelines
Community Expert ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

Okay here's a script that you can try. There are some things you need to do. You need to enlarge the image using precent. I enlarged it 2400%, so that a one pixel square would be 24 px. In the script, you have to enter the hex values of the colors in the art work and the corosponding number that you want displayed. This script takes a long time to run, as it has to sample so many areas. So try it out on a small image first. Here is my test image:

pixel add numbers.jpg

#target photoshop
var doc = activeDocument;

var step = 24;

var hexVal, colorNum, pts

//Enter hex value of numbers and then the number to be displayed into the below array
var cArray = [['000000',1],
['FFFFFF',2],
['017185',3],
['0000FF',4],
['FF0000',5],
['3CFF00',6]];

for (var k=0;k<doc.height;k+=step){
    for( var j=0;j<doc.width;j+=step){
        pts = [j+step/2,k+step/2];
        hexV = getColor ();
        colorNum = findNum()
        makeText ();
        doc.activeLayer.rasterize (RasterizeType.TEXTCONTENTS)
        if(k>0||j>0)(doc.activeLayer.merge())
        }
    }

function makeText(){
    var artLayerRef = doc.artLayers.add()
    artLayerRef.kind = LayerKind.TEXT;
    var textItemRef = artLayerRef.textItem;
    textItemRef.contents =  colorNum
    textItemRef.size =  25
    textItemRef.position= pts
    var tCenter = pts[1]-(doc.activeLayer.bounds[1].value+(doc.activeLayer.bounds[3].value-doc.activeLayer.bounds[1].value)/2);

    
    doc.activeLayer.translate (0, tCenter)
    textItemRef.justification = Justification.CENTER;   
    }

function getColor(){
    doc.colorSamplers.removeAll();
    var cS = doc.colorSamplers.add(pts);
    var rgbC = new SolidColor
    var c1 = cS.color.rgb.hexValue
    return c1
    }

function findNum(){
    for (i=0;i<cArray.length;i++){
        if (hexV == cArray[i][0]){
            return cArray[i][1]; 
            }
        }
    return ' ';
    }
               

Votes

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
community guidelines
Community Expert ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

LATEST

Awesome work as always Chuck.

Votes

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
community guidelines