如何在Photoshop中拆分文本?


9

我在Photoshop的文字图层中有一个字。我希望每个角色都在单独的图层上,该怎么做?


我有同样的问题,但它是针对句子文本层的,我需要将其分解为单词。我需要一个快捷方式,因为它的文字层太多而无法分开。而且一步一步地做需要花时间。
jjbly

Answers:


7
  1. 选择“文字”工具。
  2. 输入您的字母。
  3. 复制图层。
  4. 选择新层。
  5. 突出显示复制的字母,然后键入第二个字母。
  6. 根据需要重复。

除非您要打破“反分裂主义”,否则这是更快的方法。


9

这可以通过脚本功能来完成。

编辑:我已经尝试和测试以下更新我的答案。

  • 打开任何文本编辑器
  • 将以下代码复制并粘贴到其中
  • 确保文本层的名称与第20行中定义的名称匹配
  • 另存为splitText.jsx
  • 用Photoshop打开。还要确保您要对其应用此文档是当前活动的文档。

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;

然后请移动有关屁股的文字图层


2
ps。劳伦
·伊普苏姆(

1
我一直在寻找如何做到这一点。将此脚本放在一起的荣誉。当我靠近计算机并返回给您时,我会对其进行测试。+1!
Moshe

1
@亚当:谢谢。我为您提供+1只是为了完成所有脚本编写工作。:)
Lauren-Clear-Monica-Ipsum

2
我不知道可以使用javascript编写photoshop脚本
horatio 2011年

@Moshe @Lauren Ipsum,谢谢,我要看看是否可以进一步开发它,然后在线发布教程
Adam Elsodaney 2011

2

非常感谢亚当·埃尔索达尼(Adam Elsodaney)编写的脚本,这太神奇了-但是,如果您像我一样,并且希望脚本将单词而不是字符分开,则必须对其进行修改。

这是分解单词的相同脚本:

// 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;

只是为了澄清(我不知道,不得不谷歌搜索)

  1. 将其保存到文本文件(即扩展名为的桌面.jsx
  2. 确保在Photoshop中有一个命名的文本层,textlayer并且该文件已在Photoshop中打开。
  3. 双击文件。
  4. 利润。

编辑:对于某些共振,双击并不总是有效,如果不起作用,则在photoshp中,转到“文件”>“脚本”>“浏览”,然后双击其中的文件。它会开始运行。


1
仅供参考,如果您更改var theOriginalTextLayer = thisDocument.artLayers.getByName("textlayer");var theOriginalTextLayer = thisDocument.activeLayer;脚本,则该脚本将在选定的文本层上工作:无需将其重命名为textlayer
Sergey Kritskiy

-1

我只给我一分钱。您没有指定是否需要新图层作为可编辑文本还是仅需要光栅化图层,在后一种情况下,您可以:

  1. 栅格化图层
  2. 在第一层进行选择
  3. 按CTRL + SHIFT + J(或CMD + SHIFT + J)将选择剪切到新图层
  4. 对每个字母重复步骤2和3

同样,仅当您确定具有栅格化的图层时,才执行此操作。如果您需要文本图层,请选择Lauren Ipsum答案,因为这可能是更快的方法。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.