Skip to main content
Participating Frequently
September 1, 2018
Question

Automate a process

  • September 1, 2018
  • 2 replies
  • 5928 views

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?

This topic has been closed for replies.

2 replies

Kukurykus
Braniac
September 4, 2018

I wrote a script that put on image (but in down right corner) a date writen to metadata. It's also not on white background: Re: Way to have the "create just date " to print into photo? / Here is also rewriten version for your specific expectation:

displayDialogs = DialogModes.NO, preferences.rulerUnits = Units.PIXELS;

(aD = activeDocument).artLayers.add().kind = LayerKind.TEXT

d = aD.info.creationDate.replace(/(\d{4})(\d{2})(\d{2})/,

function(_, v1, v2, v3, v4) {return v3 + '.' + v2 + '.' + v1})

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

Try it on single layer if you know how to use this script, then it can be automated for all 180 layers. Also post your video

Stephen Marsh
Braniac
September 5, 2018

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.

Kukurykus
Braniac
September 5, 2018

Change 3rd&4th lines to d = aD.name. I didn't make pattern to position for each resolution, so most appropriate now is 300.

Stephen Marsh
Braniac
September 2, 2018

There are scripts to add the filename and or time/date stamp to the image (or EXIF metadata etc). So if you were willing to batch rename the filename to be Day 1, Day 2 etc… And if you could pull the date/time metadata out of each file, then this should be possible. Try searching in the scripting sub-forum.

how put exif data on a photo?

Otherwise, I would suggest that you look into Photoshop Variables. It should be “simple enough” to create a spreadsheet with a column for the Day 1 text and a column for the date. This could then be used to add text to each image.

Creating data-driven graphics in Photoshop

Stephen Marsh
Braniac
September 2, 2018

Here I have used Adobe Bridge to batch rename a series of images. Each image was shot on a different day. I sorted the view by date created in Bridge. The critical point is that the sort order in Bridge is used as the input order for the batch rename command. The rename used a static text of “Day “ with a space, then it used an increment number padded with two zeros.

The filename would be picked up by a script, the script would also look for the date created metadata entry in the file as well. Both of these options would then be added as a text layer to the image.

Here is a rough sample of the output of a script (JJ Mack’s StampExif.jsx) where I removed all of the variables, except for filename and date. Further tweaks may be required, such as removing filename extension or changing date format, or the font size, colour etc. This is simply a proof of concept.

MavrossAuthor
Participating Frequently
September 10, 2018

What script, where did you get it? Each reply in this forum has a little grey number in the upper left, for example I am replying to your post #23.

My original post was an edit of JJ Mack’s script, where I removed all variables from the output except filename and date created.

Then we moved on to other scripts that only used the date, or only used the filename – not both… Or so I thought.

Before we can look at changing the date format to U.S., the forum needs to know where it is coming from and how it is being used in the script. For example, if the script was the one posted by Kukurykus in reply #12, then the following change to the original line 4 code would put the month first, then the day:

function(_, v1, v2, v3, v4) {return v2 + '.' + v3 + '.' + v1})

As for the text position, my previous action posts show how to use a select all/align text to absolute upper left, move across/down fixed number of pixels and deselect to ensure that all text is consistent in placement (i.e. reply #9). Apparently this is harder to do in a script (unless my research has lead me to the wrong conclusion). I have very verbose script code to do this, but I’m sure that others can do it a lot cleaner.


My bad, I didn't see the numbers. I was talking about Kukurykus' most recent reply, 21. If you ever have a question about what code I'm referencing and I didn't specify, just assume its the latest code. I saw your reply about moving all the text, but these files are completed already and have the (wrong) date on them already. I'd have to open close to 30 of them in Photoshop and manually edit them, something that would likely take my laptop a long time to do. I guess if there's no solution in the scripts to fix it I can try it, but it would be very tedious and annoying, and probably take a couple of hours; something I'd like to avoid.