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?
4 Answers
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
-
2
-
1I 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!– MosheFeb 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
-
@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
- Select the Type tool.
- Type your letter.
- Duplicate the layer.
- Select the new layer.
- Highlight the copied letter and type the second letter.
- Repeat as needed.
Unless you're breaking up "antidisestablishmentarianism," this is the faster way to go.
-
I sincerely hope there is an easier way to do this in Photoshop in 2023. Something Coreldraw could do in 1995.– clayRayMay 1 at 5:04
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)
- Save this to a text file (I.e. to your desktop with the extension
.jsx
) - Make sure there is text layer in your photoshop named
textlayer
and that that file is open in photoshop. - Double click the file.
- 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.
-
1FYI, if you change
var theOriginalTextLayer = thisDocument.artLayers.getByName("textlayer");
tovar theOriginalTextLayer = thisDocument.activeLayer;
the script will work on a selected text layer: no need to rename it totextlayer
May 2, 2019 at 8:53
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:
- Rasterize your layer
- Make a selection around your first layer
- Hit CTRL + SHIFT + J (Or CMD + SHIFT + J) to cut the selection to a new layer
- 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.