A
A
Alexander Punktirok2019-05-27 14:44:55
Adobe Photoshop
Alexander Punktirok, 2019-05-27 14:44:55

Can Photoshop automate text replacement and export?

Good afternoon!
Yes, 200 names. These 200 names must be entered on the gift card and saved as a JPEG. The structure of the 1v1 layout is the same, only the text layer changes.
Please tell me if there is a plugin that would do something similar?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Ryzhkin, 2019-05-27
@Franciz

Yes, it is done through macro recording. Write down the actions, and then perform as many times as necessary. Look in the manuals for how to work with them.

F
Froggyweb, 2019-05-27
@Froggyweb

This is not photoshop work.
Get a corel, illustrator, or indesign. Urak on variable data will be the first in the search.
Illustrator example https://www.youtube.com/watch?v=1yCXjZyy9a8

O
Oleg Filimonenko, 2021-12-17
@Redproxima

Enjoy! A little bit of understanding in programming is enough to understand what and where to change. Cooler tricks like text strokes, shadows and other styling are too early for your case. Save the source in *.jsx format, and run File -> Scripts -> Browse... Before starting, create an empty layer over the background and put a selection on it.
The script hawala tekstovik, where in each line a new name or surname, or all together. Spaces are allowed. Line break with enter.

app.bringToFront();
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.INCHES;
app.preferences.typeUnits = TypeUnits.POINTS;
var docRef = app.activeDocument;


var textColor = new SolidColor; //Цвета текста в RGB
textColor.rgb.red = 36;
textColor.rgb.green = 36;
textColor.rgb.blue = 36;


app.displayDialogs = DialogModes.NO;
var myFile = File('/e/1. Projects/Новый Год 2022/На конверты/Кому.txt');
if (myFile.exists == true){
myFile.open('r', undefined, undefined)
var line;
var index = 1;
while(!myFile.eof)
{
line = myFile.readln();
createText(line); // создание нового текстового слоя
var file_name = app.activeDocument.activeLayer.name; 
saveJPEG( app.activeDocument, new File('/e/1/'+index+"_"+file_name+".jpeg"), 12 ); //Путь и имя сохранения. По-умоланию берется строка из текстовика
var length = app.activeDocument.layers.length;
app.activeDocument.layers[0].visible = false;
app.activeDocument.layers[1].visible = false;
//app.activeDocument.activeLayer.visible = false;
index++;
}
myFile.close();
} else {
new File(myFile);
}
function createText(text){

var text_array = text.split("|");

var newTextLayer = docRef.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.contents = text_array[0]+"";


newTextLayer.textItem.position = Array(8.30, 0.75); // расположение текста на изображении по X и Y. Придется поигарть в морской бой
newTextLayer.textItem.size = 24; // размер текста
newTextLayer.textItem.justification = Justification.RIGHT; //Якорная точка текстового слоя (Читай: выравнивание слева, справа и по центрe. Может быть RIGHT CENTER или LEFT 
newTextLayer.textItem.font = "PhillippScript"; // тип шрифта (семейство указывать не научился. Типа Regular или Italic)
newTextLayer.textItem.color = textColor; 
newTextLayer.textItem.fauxBold = false; //Жырный или нет true или false


}
function saveJPEG( doc, saveFile, qty ) {
     var saveOptions = new JPEGSaveOptions( );
     saveOptions.embedColorProfile = true;
     saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
     saveOptions.matte = MatteType.NONE;
     saveOptions.quality = qty; 
     doc.saveAs( saveFile, saveOptions, true );
}

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

Some of the documentation is here . The rest is googled at the request of JS Photoshop Scripting
For witchcraft with styles , I recommend (you need a ScriptingListener), you will have to read the documentation, I checked it works like a clock, but I will not describe the instructions within one post.
Good luck everyone!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question