9

I have a word in a text layer in photoshop. I want each character to be on a separate layer, how can I do that?

1
  • I have the same issue but it's for a sentence text layer which i need to break down into words. I need a shortcut because its too many text layers to break apart. and it will take time to do it one by one.
    – jjbly
    Feb 14, 2019 at 2:35

4 Answers 4

9

This can be done with scripting capabilities.

EDIT: I've update my answer below having tried and tested.

  • Open any text editor
  • Copy and paste the following code into it
  • Make sure whatever the name of the text layer is matches with what's defined in line 20
  • Save as splitText.jsx
  • Open with Photoshop. Also make sure the document you want to apply this to is the currently active document.

Contents of splitText.jsx

// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop

// in case we double clicked the file
app.bringToFront();

// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// $.level = 0;
// debugger; // launch debugger on next line

var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;

app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.POINTS;

var thisDocument = app.activeDocument;

// USE THIS LINE TO GRAB TEXT FROM EXISTING LAYER
var theOriginalTextLayer = thisDocument.artLayers.getByName("NAME-OF-LAYER");
var theTextToSplit = theOriginalTextLayer.textItem.contents;

// OR USE THIS LINE TO DEFINE YOUR OWN
// var theTextToSplit = "Hello";

// suppress all dialogs
app.displayDialogs = DialogModes.NO;

//  the color of the text as a numerical rgb value
var textColor = new SolidColor;
textColor.rgb.red = 0;
textColor.rgb.green = 0;
textColor.rgb.blue = 0;

var fontSize = 120;         // font size in points
var textBaseline = 480;     // the vertical distance in pixels between the top-left corner of the document and the bottom-left corner of the text-box

for(a=0; a<theTextToSplit.length; a++){ 
// this loop will go through each character

    var newTextLayer = thisDocument.artLayers.add();        // create new photoshop layer
        newTextLayer.kind = LayerKind.TEXT;             // set the layer kind to be text
    //  newTextLayer.name = textInLayer.charAt(a);

    var theTextBox = newTextLayer.textItem;             // edit the text
        theTextBox.font = "Arial";                      // set font
        theTextBox.contents = theTextToSplit.charAt(a); // Put each character in the text
        theTextBox.size = fontSize;                           // set font size
    var textPosition = a*(fontSize*0.7);

        theTextBox.position = Array(textPosition, textBaseline);                // apply the bottom-left corner position for each character
        theTextBox.color = textColor;

};

/* Reset */

app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
docRef = null;
textColor = null;
newTextLayer = null;

Then move the text layers about ass you please

6
  • 2
    ps. Lauren Ipsum's answer is better/easier :D Feb 1, 2011 at 23:04
  • 1
    I was looking for how to do this. Kudos for putting this script together. I will test it when I am near a computer and get back to you. +1!
    – Moshe
    Feb 2, 2011 at 0:00
  • 1
    @Adam: thank you. I'm giving you +1 just for going through all that effort of scripting. :) Feb 2, 2011 at 16:24
  • 2
    I did not know photoshop could be scripted using javascript
    – horatio
    Feb 10, 2011 at 20:38
  • @Moshe @Lauren Ipsum thanks, I'm going to see if I can develop this further, then post a tutorial online Feb 11, 2011 at 1:22
7
  1. Select the Type tool.
  2. Type your letter.
  3. Duplicate the layer.
  4. Select the new layer.
  5. Highlight the copied letter and type the second letter.
  6. Repeat as needed.

Unless you're breaking up "antidisestablishmentarianism," this is the faster way to go.

1
  • I sincerely hope there is an easier way to do this in Photoshop in 2023. Something Coreldraw could do in 1995.
    – clayRay
    May 1 at 5:04
3

Thank you so much Adam Elsodaney for your script, It's amazing - However if you're like me and wanted the script to tear apart words and not characters you'll have to modify it.

Here is the same script to break apart words:

// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop

// in case we double clicked the file
app.bringToFront();

// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// $.level = 0;
// debugger; // launch debugger on next line

var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;

app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.POINTS;

var thisDocument = app.activeDocument;

// USE THIS LINE TO GRAB TEXT FROM EXISTING LAYER
var theOriginalTextLayer = thisDocument.activeLayer;
var theTextToSplit = theOriginalTextLayer.textItem.contents;

// OR USE THIS LINE TO DEFINE YOUR OWN
// var theTextToSplit = "Hello";

// suppress all dialogs
app.displayDialogs = DialogModes.NO;

//  the color of the text as a numerical rgb value
var textColor = new SolidColor;
textColor.rgb.red = 0;
textColor.rgb.green = 0;
textColor.rgb.blue = 0;

var fontSize = 120;         // font size in points
var textBaseline = 480;     // the vertical distance in pixels between the top-left corner of the document and the bottom-left corner of the text-box


var words = theTextToSplit.split(" ");

for(a=0; a < words.length; a++){ 
// this loop will go through each character

    var newTextLayer = thisDocument.artLayers.add();    // create new photoshop layer
        newTextLayer.kind = LayerKind.TEXT;             // set the layer kind to be text

    var theTextBox = newTextLayer.textItem;             // edit the text
        theTextBox.font = "Arial";                      // set font
        theTextBox.contents = words[a];                 // Put each character in the text
        theTextBox.size = fontSize;                     // set font size
    var textPosition = a*(fontSize*0.7);

        theTextBox.position = Array(textPosition, textBaseline);    // apply the bottom-left corner position for each character
        theTextBox.color = textColor;

};

/* Reset */

app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
docRef = null;
textColor = null;
newTextLayer = null;

And just to clarify (As I didn't know, had to google it)

  1. Save this to a text file (I.e. to your desktop with the extension .jsx)
  2. Make sure there is text layer in your photoshop named textlayer and that that file is open in photoshop.
  3. Double click the file.
  4. Profit.

Edit: For some reson double clicking doesnt always work, and if it doesnt, In photoshp go to File > Scripts > Browse and double click the file in there. It'll start to run.

1
  • 1
    FYI, if you change var theOriginalTextLayer = thisDocument.artLayers.getByName("textlayer"); to var theOriginalTextLayer = thisDocument.activeLayer; the script will work on a selected text layer: no need to rename it to textlayer May 2, 2019 at 8:53
-1

I'll just give my penny. You didn't specified whether you need your new layers as editable text or just rasterized layers, in the latter case you can:

  1. Rasterize your layer
  2. Make a selection around your first layer
  3. Hit CTRL + SHIFT + J (Or CMD + SHIFT + J) to cut the selection to a new layer
  4. Repeat step 2 and 3 for each letter

Again, do this only if you're ok with having rasterized layers. If you need text layers go with Lauren Ipsum answer as it is probably the faster way.

Not the answer you're looking for? Browse other questions tagged or ask your own question.