Automate a process
Copy link to clipboard
Copied
So I'm trying to use Photoshop to add a number and a date in about 180 images, but I don't want to go through each one individually to add each line of text. I'm making a time lapse of myself and how I changed over 180 days (an example of this would be that I shaved my hair and I'm posting a video showing the regrowth of it over 180 days. Not what I actually did but it is similar, and you can find many videos like this on YouTube demonstrating what I'm trying to do), and I'd like to add the date for each photo I took, and what day it was in the process (i.e. day 1, day 2, day 37, day 180). I'm new to Photoshop, so I don't know much about the program, but I know there's a batch command somewhere; I wasn't able to find a tutorial anywhere on the specific thing I'm trying to do though. How could I add the specific day and date for each photo while not having to go through all of them individually?
Explore related tutorials & articles
Copy link to clipboard
Copied
Haha, you should see how many lines of code my hack contains, and you did it in 9!
I can’t figure out how to replace info.creationDate in line 3 to the filename.
Copy link to clipboard
Copied
Change 3rd&4th lines to d = aD.name. I didn't make pattern to position for each resolution, so most appropriate now is 300.
Copy link to clipboard
Copied
Fantastic, I added a regex replace to remove the filename extension. I also took the liberty of declaring the variables and adding in support for flattening if required:
// https://forums.adobe.com/thread/2530893
// https://forums.adobe.com/message/10599369#10599369
// https://forums.adobe.com/message/10601459#10601459
displayDialogs = DialogModes.NO, preferences.rulerUnits = Units.PIXELS;
(aD = activeDocument).artLayers.add().kind = LayerKind.TEXT
var d = aD.name.replace(/\.[^\.]+$/, '')
var d = aD.name.replace(/\.[^\.]+$/, '')
var s = aD.height / 100 * 5 * 72 / aD.resolution;
(tI = aD.activeLayer.textItem).contents = d
tI.position = [85, 170], col = new SolidColor
col.rgb.hexValue = 'FFFFFF'
tI.color = col, tI.size = s
//aD.flatten(); // Remove the leading double comment slashes to flatten the file
Copy link to clipboard
Copied
Personally I don't see any adventage in using variables until they have to be used when there are situations script can't work without them (proper way / at all) while reading binaries, using some UI dialogs, applying recursive function and sometimes including other script. So a question is why you need them in this case as it is like adding semicolons at end of each line that early javascript version still needed to work properly (however that might be helpful if someone doesn't want to remember to not breaking lines when later taking a code toSource() to be eveluated by other script)?
Copy link to clipboard
Copied
You of course know what you are doing, I’m just fumbling around in the dark with 0.1% knowledge... So every declaration, semicolon and comment is a guiding light.
Copy link to clipboard
Copied
Sorry about the delay I just wasn't able to connect to any internet for a bit. The script that was posted most recent worked perfectly, and is exactly what I wanted! Now, how do I automate it for all the photos? I looked in the batch action and under the action drop down thing there are no options for running scripts (that I'm aware of). Thanks
Copy link to clipboard
Copied
You mean sample script I wrote did what you wanted or that some by Stephen_A_Marsh, as you answer to him? Did you even try mine in first instance that I can rewrite it for your needs? As to automation it is late here now. I will do it tomorrow.
Copy link to clipboard
Copied
Please review my post #5:
Create a new Action Set (the name I used below was Filename to Layer, however this could be anything).
Create a new Action (the name I used below was Run, however this could be anything).
Using the Action panel menu option on the upper right, select the Insert menu command and select the File > Scripts “installed script name” – being the unknown name of the script that you saved and installed into Photoshop. (here I used the AddFileName20pt script, however the name of the script that you will be using is going to be different, this is just an example):
The final action should only have 1 step – calling the installed script by name.
Then use File > Scripts > Image Processor to process a folder of images (start small fist before processing heaps of files). There is an option at the foot of the window to reference an action set and action (which is in turn referencing a script).
You can also use File > Automate > Batch and select the action set and action, however that may mean that you need to include a different file format save as step in your action and override the save as commands, which is why I am suggesting that you use Image Processor instead of Batch.


-
- 1
- 2