Tengo una palabra en una capa de texto en Photoshop. Quiero que cada personaje esté en una capa separada, ¿cómo puedo hacer eso?
Esto se puede hacer con capacidades de secuencias de comandos.
EDITAR : actualicé mi respuesta a continuación después de haber probado y probado.
Contenido de 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;
Luego mueve las capas de texto sobre el culo que quieras
A menos que esté acabando con el "antidesestablecimiento", este es el camino más rápido a seguir.
Muchas gracias, Adam Elsodaney, por tu guión. Es increíble. Sin embargo, si eres como yo y querías que el guión rompiera las palabras y no los personajes, tendrás que modificarlo.
Aquí está el mismo script para separar palabras:
// 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;
Y solo para aclarar (Como no sabía, tuve que googlearlo)
.jsx
)textlayer
y que ese archivo esté abierto en Photoshop.Editar: para algunas resonancias, hacer doble clic no siempre funciona, y si no es así, en Photoshop, vaya a Archivo> Scripts> Examinar y haga doble clic en el archivo allí. Empezará a funcionar.
var theOriginalTextLayer = thisDocument.artLayers.getByName("textlayer");
a var theOriginalTextLayer = thisDocument.activeLayer;
la secuencia de comandos, funcionará en una capa de texto seleccionada: no es necesario cambiarle el nombre atextlayer
Solo daré mi centavo. No especificó si necesita sus nuevas capas como texto editable o simplemente capas rasterizadas, en el último caso puede:
Nuevamente, haga esto solo si está de acuerdo con tener capas rasterizadas. Si necesita capas de texto, vaya con la respuesta de Lauren Ipsum, ya que probablemente sea la forma más rápida.
jjbly