ฉันมีคำในเลเยอร์ข้อความใน photoshop ฉันต้องการให้ตัวละครแต่ละตัวอยู่ในเลเยอร์ที่แยกจากกันฉันจะทำอย่างนั้นได้อย่างไร
ฉันมีคำในเลเยอร์ข้อความใน photoshop ฉันต้องการให้ตัวละครแต่ละตัวอยู่ในเลเยอร์ที่แยกจากกันฉันจะทำอย่างนั้นได้อย่างไร
คำตอบ:
ถ้าคุณไม่เลิก "antidisestablishmentarianism" นี่เป็นวิธีที่เร็วกว่าที่จะไป
สิ่งนี้สามารถทำได้ด้วยความสามารถในการเขียนสคริปต์
แก้ไข : ฉันได้อัปเดตคำตอบด้านล่างหลังจากได้ลองและทดสอบ
เนื้อหาของ 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;
จากนั้นย้ายเลเยอร์ข้อความเกี่ยวกับตูดที่คุณโปรด
ขอบคุณ 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;
และเพื่อชี้แจง (อย่างที่ฉันไม่รู้ต้อง google มัน)
.jsx)textlayerและไฟล์นั้นเปิดอยู่ใน photoshopแก้ไข:สำหรับการคลิกสองครั้งของ reson บางครั้งอาจไม่ได้ผลและถ้าไม่ได้ใน photoshp ให้ไปที่ไฟล์> สคริปต์> เรียกดูแล้วดับเบิลคลิกที่ไฟล์ในนั้น มันจะเริ่มทำงาน
var theOriginalTextLayer = thisDocument.artLayers.getByName("textlayer");ไปvar theOriginalTextLayer = thisDocument.activeLayer;สคริปต์ที่จะทำงานบนชั้นข้อความที่เลือก: ไม่จำเป็นต้องเปลี่ยนชื่อไปtextlayer
                    ฉันจะให้เงินของฉัน คุณไม่ได้ระบุว่าคุณต้องการเลเยอร์ใหม่เป็นข้อความที่แก้ไขได้หรือเพียงแค่เลเยอร์แบบแรสเตอร์ในกรณีหลังคุณสามารถ:
ทำเช่นนี้อีกครั้งเฉพาะในกรณีที่คุณโอเคเมื่อมีเลเยอร์ที่แรสเตอร์แล้ว หากคุณต้องการเลเยอร์ข้อความให้ตอบด้วย Lauren Ipsum เพราะอาจเป็นวิธีที่เร็วกว่า